smarthome icon indicating copy to clipboard operation
smarthome copied to clipboard

Feature request: Delete 0 byte cache files in Admin Interface

Open onkelandy opened this issue 2 years ago • 4 comments

I just came across the issue of running out of disk space. Some cache files are now f** up, meaning they have 0 bytes. On startup I get this message:

Problem reading cache: Ran out of input

So far so good. Deleted those files manually and system is up and running without warnings. However, it would be cool to extend the cache check in the admin interface to find 0 byte files and delete them on demand.

onkelandy avatar Sep 11 '22 19:09 onkelandy

Hm. Why not simply delete 0 byte cache files regardless of the admin interface? I mean having 0 byte cache files is pure nonsense...?

bmxp avatar Sep 14 '22 16:09 bmxp

Yeah that would actually be the better strategy. On startup 0 bytes cache files could be deleted automatically..?

onkelandy avatar Sep 14 '22 16:09 onkelandy

@onkelandy Are you going to implement this and give a PR?

bmxp avatar Sep 15 '22 11:09 bmxp

Will try that soon, yeah. Think I will change line 417 here https://github.com/smarthomeNG/smarthome/blob/master/lib/item/item.py

and check if os.stat(self._cache).st_size == 0 -> delete file. Gotta make sure it works on all OSes though.

onkelandy avatar Sep 19 '22 12:09 onkelandy

With the next change of the item's value the cache file should have the new value written to it. Or are the values of the items with the broken cache file changed only seldom?

msinn avatar Feb 22 '23 13:02 msinn

Deletion of 0 byte cache files implemented with commit 419de34

msinn avatar Feb 22 '23 14:02 msinn

SmartHomeNG v1.9.4 has been released

msinn avatar Mar 14 '23 12:03 msinn