mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-08-09 13:23:22 +00:00
At startup the node estimates its offline gap from the persisted last-online timestamp: within the sync window it catches up via full-node reconciliation (retrying until a sync peer is found, with the periodic sync loop as safety net); beyond the window, or on fresh start, it falls back to a bounded store resume, waiting for a store peer before consuming retry attempts. The catch-up runs as a background future so node startup no longer blocks up to 90 s on store peers, and shutdown bounds its cancellation wait. StoreResume is also mounted on sync-enabled full nodes so they track last-online. Part of the "Store as a startup-only dependency" experiment (step 10). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
33 lines
1.1 KiB
Nim
33 lines
1.1 KiB
Nim
{.used.}
|
|
|
|
import testutils/unittests, chronos
|
|
import
|
|
../../logos_delivery/waku/node/waku_node, ../../logos_delivery/waku/waku_core/time
|
|
|
|
suite "Startup catch-up decision (store as a startup-only dependency)":
|
|
const SyncRange = 1800.seconds # 30 min window
|
|
let now = getNowInNanosecondTime()
|
|
|
|
test "gap within the sync window uses reconciliation":
|
|
let lastOnline = now - 300 * 1_000_000_000'i64 # 5 min ago
|
|
|
|
check useSyncCatchUp(true, lastOnline, now, SyncRange)
|
|
|
|
test "gap at the window boundary uses reconciliation":
|
|
let lastOnline = now - 1800 * 1_000_000_000'i64
|
|
|
|
check useSyncCatchUp(true, lastOnline, now, SyncRange)
|
|
|
|
test "gap beyond the sync window falls back to store resume":
|
|
let lastOnline = now - 2700 * 1_000_000_000'i64 # 45 min ago
|
|
|
|
check not useSyncCatchUp(true, lastOnline, now, SyncRange)
|
|
|
|
test "fresh start (no last-online record) falls back to store resume":
|
|
check not useSyncCatchUp(true, Timestamp(0), now, SyncRange)
|
|
|
|
test "without reconciliation mounted always falls back to store resume":
|
|
let lastOnline = now - 300 * 1_000_000_000'i64
|
|
|
|
check not useSyncCatchUp(false, lastOnline, now, SyncRange)
|