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:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user