Skip to content

W2-T06: TTL-cache _load_gateway_config + hoist call in message handler - #7

Merged
blaketyndall-eng merged 1 commit into
pr-25159from
post-audit-sprint/W2-T06
May 14, 2026
Merged

blaketyndall-eng merged 1 commit into
pr-25159from
post-audit-sprint/W2-T06

Conversation

@blaketyndall-eng

Copy link
Copy Markdown
Owner

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@blaketyndall-eng
blaketyndall-eng merged commit bbbe4df into pr-25159 May 14, 2026
3 checks passed
@blaketyndall-eng
blaketyndall-eng deleted the post-audit-sprint/W2-T06 branch May 14, 2026 16:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread gateway/run.py
Comment on lines +972 to +973
if _config_cache_value is not None and now < _config_cache_expires_at:
return _config_cache_value

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant