Skip to content

Added mechanism to recover redis adter we degrade to in-memory [CLD-320]#461

Merged
maykcaldas merged 2 commits into
fix/rate-limiter-redis-timeoutfrom
fix/add-redis-recover
Jun 23, 2026
Merged

Added mechanism to recover redis adter we degrade to in-memory [CLD-320]#461
maykcaldas merged 2 commits into
fix/rate-limiter-redis-timeoutfrom
fix/add-redis-recover

Conversation

@maykcaldas

Copy link
Copy Markdown
Collaborator

No description provided.

@maykcaldas maykcaldas requested a review from jabra June 19, 2026 00:33
@maykcaldas maykcaldas self-assigned this Jun 19, 2026
Copilot AI review requested due to automatic review settings June 19, 2026 00:33
@maykcaldas maykcaldas changed the base branch from main to fix/rate-limiter-redis-timeout June 19, 2026 00:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates GlobalRateLimiter to optionally recover Redis-backed rate limiting after it has degraded to in-memory mode due to repeated Redis operation failures, using a configurable cooldown interval.

Changes:

  • Added RATE_LIMITER_REDIS_RECOVERY_INTERVAL and tracked degradation time to enable periodic Redis recovery probes.
  • Implemented _maybe_recover_redis() and integrated it into _test / _hit so recovery can occur automatically after cooldown.
  • Expanded unit tests to cover degradation timestamping and multiple recovery scenarios (skipped, succeeds, fails, cooldown not elapsed).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/lmi/src/lmi/rate_limiter.py Adds recovery interval config, degradation timestamping, and Redis recovery probe logic invoked before rate limiter ops.
packages/lmi/tests/test_rate_limiter.py Adds tests validating degradation timestamping and Redis recovery behavior across success/failure/skip cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/lmi/src/lmi/rate_limiter.py
@maykcaldas maykcaldas force-pushed the fix/add-redis-recover branch from 995db17 to 41225a3 Compare June 19, 2026 00:40
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@maykcaldas maykcaldas force-pushed the fix/add-redis-recover branch from 41225a3 to 5c88b04 Compare June 19, 2026 00:48
@maykcaldas maykcaldas merged commit 25ec46d into fix/rate-limiter-redis-timeout Jun 23, 2026
7 checks passed
@maykcaldas maykcaldas deleted the fix/add-redis-recover branch June 23, 2026 19:49
@maykcaldas maykcaldas changed the title Added mechanism to recover redis adter we degrade to in-memory Added mechanism to recover redis adter we degrade to in-memory [CLD-320] Jun 24, 2026
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.

2 participants