Skip to content

feat(rate-limit): add distributed Redis throttling#355

Merged
devIKargi merged 1 commit into
StellAIverse:mainfrom
bobthecomputer:feat/rate-limit-345-redis
Jul 23, 2026
Merged

feat(rate-limit): add distributed Redis throttling#355
devIKargi merged 1 commit into
StellAIverse:mainfrom
bobthecomputer:feat/rate-limit-345-redis

Conversation

@bobthecomputer

Copy link
Copy Markdown
Contributor

Closes #345

Summary

  • replace the duplicate process-local and stub limiters with one Redis-backed service
  • use one atomic Lua operation for token-bucket and leaky-bucket decisions across instances
  • identify callers by authenticated user, hashed API key, or IP address
  • support per-identifier policy overrides plus RBAC-protected whitelist and blacklist administration
  • return standard rate-limit and retry headers and expose Prometheus decision and rejection metrics
  • wire the existing rate-limit decorators to the distributed guard and document configuration and operations

Verification

  • npm test -- --runInBand common/guard/quota.guard.spec.ts common/throttler/sensitive-throttler.guard.spec.ts quota/rate-limiter.service.spec.ts quota/redis-rate-limit.store.spec.ts quota/rate-limit-admin.controller.spec.ts (19 tests passed)
  • npm run build
  • changed-file ESLint check (0 errors; 2 pre-existing unused-import warnings in portfolio.controller.ts)
  • git diff --check

The concurrency test drives two service instances through one shared atomic store and accepts exactly the configured capacity. The Redis adapter test verifies that each production decision is one EVAL. A live Redis integration test was not run because the local Docker daemon is unavailable.

I began this implementation after posting interest and before the issue was assigned. There was no competing pull request at submission time.

@devIKargi
devIKargi merged commit 22e3a15 into StellAIverse:main Jul 23, 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.

Build Rate Limiting module: Redis-backed per-user/IP throttling middleware

2 participants