OokTech/TW5-Bob

Make a more robust handler for save errors on the server

Opened this issue · 0 comments

There are some very rare edge cases that could cause the server and browser to be out of sync. These problems are not unique to Bob, the core and its savers have the same potential issues. They are very rare so ignoring them is generally reasonable.

At the moment if a websocket message is received and acknowledged the server and browser assume that it was a success. There may be rare cases where there is an error saving or deleting a tiddler on the server and this isn't reflected in the browser.

The only thing that would currently detect and fix an error like this is updating the affected tiddler or restarting the server.

Bob currently uses tiddler hashes to detect if a tiddler has changed when receiving a save message, we could periodically compare these hashes for all of the synced tiddlers and if there is a mismatch attempt a fix and if that fails alert the user.

The biggest issue is determining priority when deciding if the browser or server version is correct. This gets more complex when there are multiple users, or multiple open browsers connected to the same wiki.

As a first step I am going to implement a way to check the in-browser hash against the server hash to see if they match without a resolution option other than exporting the html and seeing what tiddlers are different when you reload from the server.