Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


/var/local/www/currentsong.txt is empty sometimes
#3
Hi Tim

I was using up arrow to repeat the command, and the file was empty three times, so it was probably empty for around a second. Because the file is opened for writing before the data is collected, maybe some of the data collection/processing is taking longer than expected (maybe interupted by another process) and the file then has zero length for longer than expected (I am on a Pi Zero with not much CPU headroom).

Regarding the implementation, it might avoid access issues if the file was written to another name and then renamed to currentsong.txt afterwards. (The zero-length window could be reduced by opening the file for writing after the data is collected, but the rename should avoid the empty file altogether.)

Adrian.
Reply


Messages In This Thread
RE: /var/local/www/currentsong.txt is empty sometimes - by adrii - 05-11-2021, 02:05 PM

Forum Jump: