ai_co_discuss 0.3.72 → 0.3.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai_co_discuss",
3
- "version": "0.3.72",
3
+ "version": "0.3.73",
4
4
  "bin": {
5
5
  "codiscuss": "runner/codiscuss.mjs"
6
6
  },
@@ -20,6 +20,7 @@ const LOOP_MS = 500;
20
20
  const REMOTE_POLL_MS = 10_000;
21
21
  // A hosted site is asked this often which rooms changed; an idle room is read in full only then, or at the safety interval.
22
22
  const REVISION_POLL_MS = 3000;
23
+ // Safety interval for an idle room whose changes arrive by revision or update stream (local sites included).
23
24
  const IDLE_REMOTE_POLL_MS = 5 * 60_000;
24
25
  const REVISION_TIMEOUT_MS = 10_000;
25
26
  const UPDATE_RETRY_MS = 5000;
@@ -425,9 +426,11 @@ export class DiscussionService {
425
426
  .finally(() => {
426
427
  // Counted from the end of the tick, once the room's site is known; a slow site does not poll back to back.
427
428
  const local = !worker.state.site || LOOPBACK.has(new URL(worker.state.site).hostname);
428
- // An idle hosted room waits for its revision to change; a site without revisions keeps the regular interval.
429
- const watched = worker.idle && this.revisions.get(worker.state.site)?.supported !== false;
430
- worker.next_at = Date.now() + (local ? this.intervals.local : watched ? this.intervals.idle : this.intervals.remote);
429
+ // An idle room waits for its site's update stream or, on a hosted site, its revision to change; a site with
430
+ // neither keeps the regular interval. Polling every idle local room each interval kept the website busy.
431
+ const streamed = Date.now() - (this.streams.get(worker.state.site)?.heard_at ?? 0) < STREAM_STALE_MS;
432
+ const watched = worker.idle && (streamed || (!local && this.revisions.get(worker.state.site)?.supported !== false));
433
+ worker.next_at = Date.now() + (watched ? this.intervals.idle : local ? this.intervals.local : this.intervals.remote);
431
434
  worker.busy = null;
432
435
  if (worker.woken && this.workers.get(path) === worker) { worker.woken = false; this.start(path, worker); }
433
436
  });