refactor(federation): replace runInitialSyncForNewPeers with startupBootstrapSync

The per-peer sync body is now syncPeerMutationLog (in the new
peer-activation module), invoked via onPeerActivated. The startup
path scans for status='active' AND lastSyncedAt=0 and calls the
unified handler for each — same trigger condition as before, unified
code path with runtime transitions.
This commit is contained in:
Jannis Braun
2026-04-22 00:28:18 +02:00
parent cca2245cdf
commit 02a1ed73f4
2 changed files with 16 additions and 113 deletions
@@ -164,5 +164,16 @@ export async function syncPeerMutationLog(
* Invoked from startFederationWorkers.
*/
export async function startupBootstrapSync(): Promise<void> {
// Stub — implemented in Task 5.
if (!isFederationRelayEnabled()) return;
const db = getDb();
const peers = db.select().from(schema.federationPeers)
.where(and(
eq(schema.federationPeers.status, 'active'),
eq(schema.federationPeers.lastSyncedAt, 0),
)).all();
for (const peer of peers) {
await onPeerActivated(peer.id, 'startup_bootstrap');
}
}