I use syncthing as a means to sync data between servers. One server is the master and the other the slave. It doesn’t generally happen, but if a file gets placed on the slave or modified on the slave, it throws the master out of sync. What is the best way to detect this? /rest/db/status can be used on the master to monitor for needFiles or needBytes, but this is an expensive call. Is there a better way to monitor via the API for the status of the folder? I would like to make an API call every 1 - 5 minutes for the monitoring.
Completion call is probably more simple, yet all of them are somewhat expensive as they need to check the database. Calling it once every 5 minutes on a normal power machine is perfectly fine. Alternatively, if you could write something that listens on the events API and looks for RemoteIndexUpdated events when you don’t expect them (master hasn’t changed anything).
So if the percentage is anything other than 100, they are out of sync? I am monitoring the db completion for the paired device and if it’s anything other than 100% over several checks, then declare it as out of sync.
I don’t have a means to keep the lastSeen event ID persistent, so that is more difficult to implement in this case.