Skip to content

fix(cache): gracefully degrade Redis cache on connection failure - #100

Open
jack-o-brown wants to merge 1 commit into
Continuum-AI-Corp:mainfrom
jack-o-brown:fix/redis-cache-graceful-degradation
Open

jack-o-brown wants to merge 1 commit into
Continuum-AI-Corp:mainfrom
jack-o-brown:fix/redis-cache-graceful-degradation

Conversation

@jack-o-brown

@jack-o-brown jack-o-brown commented Sep 14, 2026

Copy link
Copy Markdown

Orca-Code-Review — push 1

Severity Count
P0 0
P1 0
P2 0
P3 0

✅ no blocking findings

When REDIS_URL is set but Redis is unreachable, RedisCache.get() and RedisCache.set() raise ConnectionError / TimeoutError which propagates to the chat handler and crashes the request with a 500.

The prompt cache is an optimization — a Redis outage should degrade to cache misses, not take down the router. The upstream provider call still succeeds; the next request retries the cache write.

Fix: wrap both get() and set() in try/except Exception so connection errors are caught:

  • get() returns None (cache miss) — caller hits upstream normally
  • set() is a no-op — next request retries the write

Tests: tests/unit/test_redis_cache_graceful.py — verifies ConnectionError and TimeoutError are caught on both get() and set().

When Redis is unreachable, RedisCache.get() and RedisCache.set() raise
ConnectionError/TimeoutError which propagates to the request handler
and crashes the request with a 500. The cache is an optimization, not
a correctness requirement — a Redis outage should degrade to cache
misses, not take down the router.

Wrap both get() and set() in try/except so connection errors are caught:
get() returns None (cache miss), set() is a no-op. The upstream call
still succeeds and the next request retries the cache write.

@orcacode-review orcacode-review 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.

🐳 OrcaCode Review

No findings — nothing to flag in this PR. Great work!

OrcaCode Review — Route Smarter. Ship Safer. Spend Less.
Engine-reported: 277 calls · 10.6M tokens · 98% cached

❤️ Share · Install OrcaCode Review

Free on GitHub — the review runs on your own OrcaRouter key. If it helped, a shout-out goes a long way.

Share: X · Reddit · LinkedIn
Follow: X · Discord · LinkedIn · OrcaRouter

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