Add per-remote sync_interval and spread GitHub syncs #166
Reference in New Issue
Block a user
Delete Branch "benvin/github-sync-spread"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
github_* remotes sharing a mutable_ttl all become due at the same moment, so many remotes created or synced together burst GitHub at once.
sync_interval(seconds) for github_rpm/github_deb/github_alpine remotessync_intervalis unsetsync_intervalin README, rpm docs and UI typessync_intervalunset (mutable_ttl only) also move from "ttl since last sync" to phased boundaries; this contradicts "0 keeps mutable_ttl" prior behaviour, and a sync landing just before a boundary (retry success, prime) re-syncs seconds later → gate the phased maths on sync_interval being set (e.g. pass phase 0 / keep old predicate when unset), or state and test the behaviour change.last_synced_at IS NULL) and prime (freshness 0) stay unspread, so remotes created together still burst on first sync → state as out of scope or stagger the first sync by phase.sync_interval→ update.slot = job.remote.SyncSlot(time.Now())) and internal/database/github_sync.go claimSyncLease (last_synced_at < $5) — the slot boundary is computed on the replica's clock but compared to last_synced_at, which the release stamps with the DBnow(). A replica whose clock is ahead by d claims at its own slot start while DB time is still before it, so the release writes last_synced_at < slot and the remote stays due: it re-claims and rescans every poll tick until the DB clock passes the slot. Replicas that disagree also pick different slots → pass interval and phase to the claim and compute the slot in SQL fromnow(); keepSyncSlotonly for the unit-testable maths.job.remote.CreatedAt.Before(slot)) — same mix: created_at is a DB timestamp, slot is replica-clock. Skew can release the first-slot wait early or hold it a slot too long → do the created_at gate in the same SQL claim against the DB-computed slot.time.Now().Format(...), and seeded last_synced_at usestime.Now().Add(...); use a counter for names.sync_intervalrow to the remote fields table in docs/common/caching.md.