feat: idle eviction for pooled resident adapters - #130
Conversation
A pooled instance nobody rents for ResidentOptions.IdleTimeout (or a per-adapter "IdleTimeoutSeconds" override) is now retired by the supervisor's existing sweep, so a warm pool shrinks back down instead of holding its peak size forever. Off by default. Exclusive instances are never affected. Adds IdleSince to ResidentAdapterInstance/InstanceHealth so the state is observable, and wires a demo into SW.Serverless.SampleWeb (Carrier page + Adapters dashboard) to show it live. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: simplify9/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (10)
📝 SummarySummaryAdds idle eviction for pooled resident adapters.
Riskrisk:medium. The change affects concurrent pool checkout, return, reset, and eviction behavior. Security-sensitive areasNo authentication, authorization, or secret-handling code changed. The lifecycle changes affect resource retention and process retirement. Test coverageAdds coverage for default and per-adapter timeouts, re-renting, exclusive instances, partial eviction, and disabled eviction. The reported test run passed 80 unit tests. Solution and SampleWeb builds passed. Operational concernsEviction remains disabled when WalkthroughThe change adds idle tracking and timeout-based eviction for pooled resident adapter instances. Supervisor cycles remove stale pooled instances, while exclusive instances remain active. Health output and sample pages expose idle state. Tests cover timeout inheritance, overrides, re-renting, staggered pools, and disabled eviction. ChangesPooled adapter idle eviction
Estimated code review effort: 4 (Complex) | ~45 minutes Change: Feature Suggested labels: Suggested reviewers: Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
ResidentOptions.IdleTimeout(default off), or a per-adapterIdleTimeoutSecondsmetadata override, is retired by the host's existing supervisor sweep — so a warm pool shrinks back down instead of holding its peak size forever.IdleSinceonResidentAdapterInstance/InstanceHealthso the state is observable.SW.Serverless.SampleWeb: the Carrier page overrides the idle timeout per-adapter, and the Adapters dashboard shows "Idle for" and lets you watch an instance disappear once evicted.Test plan
dotnet build SW.Serverless.slndotnet test SW.Serverless.UnitTests— 80/80 passing, including newIdleEvictionTestscovering: host-default-with-no-override, explicit-zero-override-falls-back-to-default (not disabled), renting-again-cancels-eviction, exclusive-instances-never-evicted, partial-eviction-with-multiple-idle-instances, andIdleTimeout = TimeSpan.Zerodisabling eviction entirely.SW.Serverless.SampleWebbuilds; Carrier + Adapters pages updated to demo the feature manually.🤖 Generated with Claude Code