chiefwigms / picobrew_pico

MIT License
149 stars 63 forks source link

Tilt Session Recovery from Power Loss Corruption #305

Closed wiltdavi closed 2 years ago

wiltdavi commented 3 years ago

I found that after a power outage an active Tilt session would not load. When the server was rebooted the session would show as active but no data was on the graph.

image

I found that this was due to NULL characters being at the end of the log file.

image

Since there was already a recover_incomplete_session function, to resolve this issue I added an endswith for NULL (\x00) which reverse strips them and fixes an open comma which recovers the session properly.

With this update a corrupted file is automatically recovered properly.

image

Here is a example of a corrupted session file. It has been renamed from .json to .txt so I could upload it. 20210807_164541#Orange-C71885D66A9C.txt