event id has been reset when syncthing restart?

Hi, I developing app using syncthing.

I save syncthing last event id value on local file(as app setting file) to avoid recv all event when my app restarting.

I want to get events only after last seen even if restart app, but after my system restart. it seems that event id reset to 0, Is it right? then is there any way persistent it?

It is reset every time the backend restarts. Don’t worry about getting older events, they are also discarded upon restart.

I suppose your workaround is for the case when your app restarts, but the backend didn’t. I guess in that case you should try to get the most recent event and maybe a fixed maximum number of backlog entries. The most recent event ID can be retrieved from a running instance somewhere in the API if I remember correctly.

EDIT: See GET /rest/events — Syncthing documentation, there is a hint about how to get the latest event ID.

1 Like