From a28302eee33dab5f0829ff6310242beb0a744ef7 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 4 Jul 2026 07:32:42 -0700 Subject: Ark: real-time receives over the SubscribeMailbox gRPC stream grpcStream() parses gRPC-web frames incrementally off fetch's body stream; the manager keeps a long-lived SubscribeMailbox subscription (auto-reconnect, 3s backoff) whose messages flow through the same duplicate-safe processing as the poll. Receives now land the moment the sender delivers (~sub-second) instead of on the next poll; the poll stays as fallback and to drive in-flight boards/refreshes. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01QFAcD4V284DvYZZHP7Rxxy --- src/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/app.js') diff --git a/src/app.js b/src/app.js index 61b453b..efb0bc4 100644 --- a/src/app.js +++ b/src/app.js @@ -42,6 +42,7 @@ function stopArk() { arkInitGen++; if (arkTimer) clearInterval(arkTimer); arkTimer = null; + if (ark) ark.stopMailboxStream(); ark = null; arkConnectPromise = null; } @@ -89,7 +90,9 @@ function connectArk() { ark = mgr; const tick = () => mgr.sync().catch(() => {}); tick(); - // Regtest rounds are seconds apart; on mainnet a slower poll is plenty. + // Receives arrive in real time over the mailbox stream; the poll is the + // fallback and what drives in-flight boards/refreshes forward. + mgr.startMailboxStream(); arkTimer = setInterval(() => { if (ark === mgr) tick(); }, getNetwork() === 'regtest' ? 5000 : 30000); render(); return mgr; -- cgit v1.2.3