What function does `cleanInterval` serve in Staggered File Versioning?

This is the original PR that introduced Staggered File Versioning:

https://github.com/syncthing/syncthing/pull/541.

The config.xml syntax back then looked as follows.

<versioning type="staggered">
    <param key="versionsPath" val="xxx"></param>
    <param key="cleanInterval" val="3600"></param>
    <param key="maxAge" val="31104000"></param>
</versioning>

Nowadays, the syntax has changed into this.

<versioning type="staggered">
    <param key="cleanInterval" val="3600"></param>
    <param key="maxAge" val="31104000"></param>
    <cleanupIntervalS>3600</cleanupIntervalS>
    <fsPath></fsPath>
    <fsType>basic</fsType>
</versioning>

My question is essentially about the two values listed in cleanInterval and cleanupIntervalS. The latter is the normal cleanup interval that we can also set using the GUI. The former though isn’t presented in the GUI anywhere, and its value is always set to 3600.

The original explanation of cleanInterval was “cleanInterval is the interval between scanning all versions and deleting ones that are too old or when too many are in a interval (default 3600 s = 1 hour)”. Frankly speaking, I can’t grasp the difference between this and the normal cleanupIntervalS.

In other words, are the two actually different and is cleanInterval actually used in the current code?

It is not used anywhere; it appears to be just a remnant in the GUI code that sets it and then it sticks around because that config element is a list of key-value pairs that’s kind of agnostic to what they mean or if they’re used.

% git grep -i cleanInterval
gui/default/syncthing/core/syncthingController.js:            staggeredCleanInterval: 3600,
gui/default/syncthing/core/syncthingController.js:                $scope.currentFolder._guiVersioning.staggeredCleanInterval = +currentVersioning.params.cleanInterval;
gui/default/syncthing/core/syncthingController.js:                folderCfg.versioning.params.cleanInterval = '' + folderCfg._guiVersioning.staggeredCleanInterval;

I guess the best answer here is that the docs need updating on that part :wink:

I didn’t really touch that part during my recent docs cleanup and adding missing pieces. Mainly because I have little idea of how the different versioning modes actually work.

Yeah and the vestigial crap in the GUI should be removed.