W2-T06: TTL-cache _load_gateway_config + hoist call in message handler - #7
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2762f9f7c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if _config_cache_value is not None and now < _config_cache_expires_at: | ||
| return _config_cache_value |
There was a problem hiding this comment.
Respect config changes before returning the TTL hit
When config.yaml changes within 60 seconds, this early return bypasses the existing read_raw_config() mtime check entirely, so gateway settings edited on disk or saved by paths that do not mutate _config_cache_value can be ignored until the TTL expires. This regresses the previous behavior where changes were picked up on the next _load_gateway_config() call; key the TTL entry by config path/stat or validate mtime before returning the cached dict.
Useful? React with 👍 / 👎.
|




Audit W2-T06 (P2 #13).
_load_gateway_configis called 15+ times in the per-inbound-message hot path. Adds module-level 60s TTL cache and hoists a single call in_handle_messagethreaded through 4 inner helpers viagateway_configparam. 19+ unchanged sites benefit transparently from the TTL cache.