Skip to content

fix: add Redis graceful degradation and health check (#126)#205

Merged
kilodesodiq-arch merged 1 commit into
ChainForgee:mainfrom
Xuccessor:fix/issue-126-redis-graceful-degradation
Jun 29, 2026
Merged

fix: add Redis graceful degradation and health check (#126)#205
kilodesodiq-arch merged 1 commit into
ChainForgee:mainfrom
Xuccessor:fix/issue-126-redis-graceful-degradation

Conversation

@Xuccessor

Copy link
Copy Markdown
Contributor

Summary

AdaptiveRateLimitGuard previously threw an unhandled exception when Redis was unavailable, taking down all endpoints. The health check also had no visibility into Redis status. This PR adds fail-open degradation to the rate limit guard and a Redis ping check to the readiness probe.

Changes

  • adaptive-rate-limit.guard.ts: Wrap getOrThrow() and Redis operations in try/catch — logs a warning and allows requests through when Redis is down
  • health.service.ts: Add checkRedis() method using RedisService.getOrThrow().ping(); include redis key in ReadinessResponse.checks; update ReadinessResponse interface
  • health.module.ts: Import RedisModule to make RedisService injectable in HealthService
  • health.controller.spec.ts: Add RedisService mock and update assertions to include redis in readiness checks

Testing

Build and lint pass. All 4 health controller tests pass. When Redis is unavailable, rate limiting is skipped rather than throwing 500 errors.

Closes #126

@kilodesodiq-arch kilodesodiq-arch 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.

LGTM

@kilodesodiq-arch kilodesodiq-arch merged commit cf8bea4 into ChainForgee:main Jun 29, 2026
1 check passed
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.

[HIGH] No graceful degradation when Redis is unavailable

2 participants