When does cleanup trigger? (Trash can versioning)


When does the cleanup trigger? Default is 3600s, so does that mean it doesn’t take place on Syncthing startup, but every 3600s after startup? I’ve got users complaining clean up doesn’t take place, we think the root cause is that the Android app doesn’t run the Syncthingnative for at least 3600s non-stop.

My suggested workaround is to lower the cleanup interval default -or- if there is one , call a restapi endpoint “cleanupNow” immediately after Syncthingnative started up. Does such an endpoint exist?

Kind regards, Catfriend1

Ref. Staggered File Versioning never gets any Clean-Up done ? · Issue #990 · Catfriend1/syncthing-android · GitHub

I’ve recently been working on fixing some issue with the cleanup (see https://github.com/syncthing/syncthing/pull/8994/files). The relevant code is in https://github.com/syncthing/syncthing/blob/main/lib/model/folder.go, and from what I can say, it is fired on a timer, so if you exit Syncthing or stop the folder earlier, it just doesn’t run at all.

I think running it automatically on Syncthing start (or folder resume) in a similar manner as folder rescans are run could be useful.

1 Like

This would also help on Android where battery savvy people exit Syncthing or stop by run conditions whenever they can so versions do not get cleaned out at the moment.

Workaround DRAFT: Workaround cleanupIntervalS timer not firing: Force cleanup on startup (fixes #990) by Catfriend1 · Pull Request #1001 · Catfriend1/syncthing-android · GitHub

The implemented workaround in Syncthing-Fork (Android) works as follows:

  • When SyncthingNative starts up, RestApi takes care of detecting when the REST API is available after successful startup and loads the config into the wrapper’s memory.
  • It then modifies the config by setting all “cleanupIntervalS” instances to “2” (seconds) to trigger the cleanup shortly after startup.
  • After 10 seconds, it sets all “cleanupIntervalS” instances to “3600” (seconds) which is Syncthing’s default.

Disadvantages: the user no longer is able to persistently customize “cleanupIntervalS” on Android as the wrapper interacts with that values on every startup plus the next 10 seconds after it.

I’ve verified this workaround on my Android 13 phone, PixelExperience Plus on Xiaomi mi 8.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.