We had a variety of issues in the syncroton handling code:
- Race conditions where sometimes we wouldn't detect changes or attempt duplicate inserts
- Invalid handling of an empty set of members in the cache (use of empty instead of isset)
- Invalid resetting of the cache before reading, resulting in duplicate inserts
The solution is somewhat messy because we really shouldn't be using timestamps for this, but rather attach the information to the syncstate, but this seems to fix most of the issues and gets the test to reliably pass.
Supersedes https://git.kolab.org/D4896