Skip to content

Skip GC when a query is paused#39

Merged
jimmy-phantom merged 3 commits into
mainfrom
skip-gc-on-pause
Jun 12, 2026
Merged

Skip GC when a query is paused#39
jimmy-phantom merged 3 commits into
mainfrom
skip-gc-on-pause

Conversation

@jimmy-phantom

Copy link
Copy Markdown
Collaborator

Problem

Deactivating a query always scheduled garbage collection. A temporary pause (signalium's PauseSignalsProvider, or fetchium's own network-driven pause) with a low gcTime evicted the query immediately, so resuming built a brand-new query and lost its polling interval, causing a burst of redundant subscriptions.

Change

deactivate now reads the isPausing flag signalium passes and skips GC while pausing:

deactivate({ isPausing })
  -> abort fetch, clear timers, unsubscribe    // always
  -> isPausing
       ? return                                 // pause: keep the cache
       : gcManager.schedule(...)                // real teardown: GC

So the active fetch/subscription is still torn down on pause; only GC is skipped, and resume reuses the cached result.

Dependency

Requires the new DeactivateOptions (isPausing) argument on RelayHooks.deactivate from signalium: Signalium/signalium#242. CI typecheck will fail until that lands and is released.

Patch changeset included.

Deactivating a query always scheduled garbage collection. A temporary
pause (signalium's PauseSignalsProvider, or a network-driven pause) with
a low gcTime evicted the query immediately and recreated it on resume,
dropping its polling interval.

Read the isPausing flag signalium now passes to RelayHooks.deactivate and
skip GC while pausing. The active fetch and subscription are still torn
down; only GC is skipped, so the cached result survives and resume reuses
it. GC still runs on a genuine teardown.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jimmy-phantom and others added 2 commits June 12, 2026 10:32
signalium shipped the isPausing flag in a patch (3.0.3), so tightening
the peer floor is backward compatible within the 3.0.x line, not breaking.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jimmy-phantom jimmy-phantom marked this pull request as ready for review June 12, 2026 15:39
@jimmy-phantom jimmy-phantom merged commit 76df9c4 into main Jun 12, 2026
1 check passed
@jimmy-phantom jimmy-phantom deleted the skip-gc-on-pause branch June 12, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants