This is supposed to fix issue #1417, but we'll know if this is enough only after a couple of runs of the CI test without false positives.
The test checks both successful syncs and unsuccessful ones by changing the backlog size.