Igor Sirotin bad12e44b6
fix(filter): correct inverted idle-subscription cleanup check
The periodic cleanup in SubscribersMap.cleanUp deleted subscribers whose
elapsed time since last activity was *less* than the idle timeout, and kept
those that had gone idle. This is backwards: active subscribers (that keep
their subscription alive via pings, which call Refresh) were being dropped
within a cleanup cycle, while genuinely idle subscribers were never reaped
and leaked forever.

Flip the comparison so a subscriber is removed only once it has been idle
for longer than the timeout.

Also rewrite TestCleanup (which previously encoded the buggy behavior) and
add TestCleanupKeepsActiveSubscribers, which fails on the old inverted check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 09:40:12 +01:00
..