• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 24124391614

08 Apr 2026 07:54AM UTC coverage: 65.19% (+0.005%) from 65.185%
24124391614

push

github

web-flow
Update Redis metadata when backend sessions expire (RC-16) (#4404)

* Update Redis metadata when backend sessions expire (RC-16)

Add RemoveBackendFromMetadata to the MultiSession interface and implement
it on defaultMultiSession to clear the per-backend session ID key and
rebuild MetadataKeyBackendIDs when a backend disconnects or expires.

Add NotifyBackendExpired to sessionmanager.Manager to call
RemoveBackendFromMetadata and flush the updated metadata to storage
(Redis when configured), keeping Redis consistent with the actual set
of connected backends.

Closes #4213

* Evict local cache on NotifyBackendExpired; fix DataStorage tests

NotifyBackendExpired now evicts the session from the node-local
multiSessions cache after a successful storage update, and forgets
the singleflight key to prevent a concurrent restore from
re-populating the cache with stale data. This ensures same-pod
requests trigger RestoreSession with the updated metadata (without
the expired backend), not just cross-pod ones.

On storage error the cache is intentionally not evicted to avoid
serving requests against metadata that still describes the expired
backend.

Also update session_data_storage_test.go to match the API renamed in
the "fixes from review" commit: Upsert→Store, Create→Exists. Add
contract tests for Exists (false when absent, true when present, does
not refresh TTL for either local and Redis implementations). Remove
the error-return assertion from NewLocalSessionDataStorage.

* fixes from review

---------

Co-authored-by: taskbot <taskbot@users.noreply.github.com>

53 of 71 new or added lines in 2 files covered. (74.65%)

24 existing lines in 5 files now uncovered.

54873 of 84174 relevant lines covered (65.19%)

61.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.38
/pkg/transport/proxy/httpsse/http_proxy.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc