Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: await peer online subscription convergence

[._.]/ Adam Eivyfa593a446b5a
diff --git a/server/services/sharing/peerSync.test.js b/server/services/sharing/peerSync.test.js
index 163ebdffb6..4501a9c3c8 100644
--- a/server/services/sharing/peerSync.test.js
+++ b/server/services/sharing/peerSync.test.js
@@ -1115,9 +1115,11 @@ describe('peerSync', () => {
directions: ['outbound'],
syncCategories: { universe: true },
});
- // Allow the listener's fire-and-forget IIFE to settle.
- await new Promise((r) => setTimeout(r, 30));
- expect(await findPeerSubscription('peer-a', 'universe', 'u1')).not.toBeNull();
+ // Poll for the listener's fire-and-forget IIFE to persist the subscription;
+ // a fixed sleep races the write queue on slower CI runners.
+ await vi.waitFor(async () => {
+ expect(await findPeerSubscription('peer-a', 'universe', 'u1')).not.toBeNull();
+ });
});
it('reciprocates a full-sync peer on peer:online (mirror requested once identity is known)', async () => {