Make the user config cache expiry configurable - #49
Merged
Conversation
lucarlig
force-pushed
the
user-config-cache-expiry
branch
from
July 2, 2026 09:20
c1504c7 to
fe8e709
Compare
lucarlig
marked this pull request as ready for review
July 2, 2026 09:25
dawid-nowak
previously approved these changes
Jul 2, 2026
The control-plane dataplane publisher rewrites UserConfig keys in Redis every 60s with a 70s TTL, but RedisUserConfigStore cached entries with the shared LRU_CACHE_EXPIRY_DURATION of 1 hour, hardcoded in const_values.rs. Any subject already in the cache kept serving stale config for up to an hour after a change, so newly created or modified virtual servers stayed unreachable through the dataplane until a restart. Reproduced in cf-integration: a new virtual server was present in Redis within one publish cycle while the dataplane kept answering -32002 No configuration for 148s+; restarting the dataplane made the same request succeed immediately. Add user_config_cache_expiry_seconds to the config surface (--user-config-cache-expiry-seconds / CONTEXTFORGE_GATEWAY_RS_USER_CONFIG_CACHE_EXPIRY_SECONDS), defaulting to 60 to match the publisher cadence. 0 disables caching entirely and reads Redis on every request, which is useful for tests that create virtual servers at runtime. Session stores keep the 1 hour expiry so session lifetimes are unaffected. Signed-off-by: lucarlig <luca.carlig@ibm.com>
lucarlig
force-pushed
the
user-config-cache-expiry
branch
from
July 2, 2026 12:12
fe8e709 to
883410f
Compare
dawid-nowak
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The control-plane dataplane publisher rewrites
UserConfigkeys in Redis every 60s (70s key TTL), butRedisUserConfigStorecaches entries in-process with the sharedLRU_CACHE_EXPIRY_DURATIONof 1 hour, hardcoded inconst_values.rs. Any subject already in the cache keeps serving stale config for up to an hour after a change, so newly created or modified virtual servers stay unreachable through the dataplane until a restart.Reproduced in the cf-integration harness:
UserConfigwithin one cycle (verified by decoding the msgpack value).initializewith JSON-RPC-32002 No configurationfor 148s+ (more than two publish cycles).This is also the root cause of the
test_mcp_rbac_transport.pyper-server endpoint failures: servers and users created at test runtime can never become visible to a running dataplane inside the test window.See cf-integration reports/2026-07-02-dataplane-change-list.md for the full evidence.
Change
New config option, range 0..max seconds:
60, matching the publisher cadence — worst-case staleness drops from ~60 minutes to ~1 minute.0disables caching entirely (the store holds no LRU) and reads Redis on every request — intended for tests that create virtual servers/users at runtime.LRU_CACHE_EXPIRY_DURATION, so session lifetimes are unchanged.NoDataForKey.Verification
cargo fmt --check,clippy --workspace --all-targets -D warnings,deny check advisories licenses,nextest run --workspace(50/50),build --workspace, andbench --no-runall pass.