mirror of
https://github.com/keycloak/keycloak.git
synced 2026-10-23 19:29:23 +03:00
The periodic sync gate (isSyncPeriod) skipped the next timer tick whenever a sync run took longer than about a second, so the effective sync period doubled. The timer schedules each run 'period' seconds after the start of the previous run, but lastSync recorded the time the previous run finished, so the tick landed less than period - 1 seconds after the recorded time and was ignored. Capture the start of the sync run before executing it and stamp that into lastSync when the run succeeds, mirroring the timer's start-anchored scheduling. A run that throws still leaves lastSync untouched, so the next tick retries as before. Incremental sync also no longer misses entries changed while the previous run was in progress, as syncSince now receives the start of the previous run instead of its finish. Fixes keycloak#53930 Signed-off-by: choksi2212 <choksi2212@users.noreply.github.com>