I’ve been working on setting up a two-user wiki for myself and a friend this weekend. The Bob plugin has been super helpful (thanks to everyone who’s participated in that!).
To prevent collisions between different sessions, Bob locks a given tiddler when someone starts editing it. This has been working fine (aside from the fact that occasionally a lock doesn’t get released properly, but I know this is listed as a known issue, and it’s not hard to fix).
However, this doesn’t work when you edit a tiddler through, say, an $edit-text
widget. I’m working on a custom version of the commenting plugin, and while I don’t have a good understanding of how all the pieces fit together, something here seems to be biting me constantly. I have two sessions running, one with each user logged in (by “logged in” I mean they use different HTTPS basic auth logins, and I’ve patched Bob to set $:/status/UserName
based on a username header sent from an nginx proxy on each request). I’ll start typing a comment, which creates/edits a tiddler, and can see it updating in real time in the other window – and all of a sudden one of the instances stops sending or receiving from the server and the save button goes red, and cannot be revived except by reloading the page.
This would be merely be annoying, were it not for the fact that there isn’t any kind of error or immediate indication anything has gone wrong except for the button changing color. (Or rather: it’s clear to me because I have both sessions open side by side, but in a real-life situation where two people were editing simultaneously from different computers, it wouldn’t be.) So if you’re working in a narrow window or on mobile where you don’t immediately see the save button go red, you can end up doing a bunch of work which later gets lost or has to be manually reapplied.
Are there ways I can force some kind of lock here? Failing that, can I at least get an obvious error when syncing gets stuck? There’s no error message either in the server output or the console, so I’m not actually even sure what specifically is happening, much less how to hook something into it.