app now handles broken analytic json files correctly and does not stop with an error because of them, they are now ignored.
__save_json now utilizes a temp file analytics/username/streamername.json.temp:
Sometimes analytics files can be corrupted when written to disk. Solution:
First, write the data to a temporary file. After that, there will be two files on the disk - a new one and a target one.
Rename temporary file to the target.
If the application is closed or crashes on the first step, the original file will remain untouched on the disk.
0-sized and broken json files are now error-logged (you will be also informed in the console), so you can find the problem files. It will trigger when you'll try to open the analytics webpage.
__save_json
now utilizes a temp fileanalytics/username/streamername.json.temp
: