Skip to content

Conversation

@neekolas
Copy link
Contributor

@neekolas neekolas commented Oct 17, 2025

Add a Redis-backed publish rate limiter and surface Retry-After with ResourceExhausted in gRPC responses while configuring a 10s Redis connect timeout across gateway setup

Introduce a concrete Redis-backed rate limit authorizer via authorizers.NewRateLimitAuthorizer, integrate GatewayServiceError with RetryAfter and ResourceExhausted handling in the gRPC interceptor, and update the gateway builder to create or reuse a Redis client with a configurable config.RedisOptions.ConnectTimeout set to 10s. Add a builder for rate limit authorizers, refactor nonce manager setup to accept a shared Redis client, and include a runnable example wiring the limiter into the gateway.

📍Where to Start

Start with the authorizers.NewRateLimitAuthorizer implementation and its usage in the interceptor path in pkg/gateway/authorizers/ratelimit.go and then review the gRPC error mapping in pkg/gateway/interceptor.go.


📊 Macroscope summarized aeabe07. 11 files reviewed, 2 issues evaluated, 1 issue filtered, 0 comments posted

🗂️ Filtered Issues

pkg/gateway/builder.go — 0 comments posted, 1 evaluated, 1 filtered
  • line 316: SetupRedisClient calls ctx.Err() (line 316) without guarding against a nil ctx. If any caller passes a nil context (which is possible because there is no visible guard or constructor guarantee preventing it), the method call panics with invalid memory address or nil pointer dereference, crashing the process before the Redis client is set up. Add an explicit nil check (e.g., return an error or substitute context.Background()) before dereferencing ctx. [ Out of scope ]

Copy link
Contributor Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • Queue - adds this PR to the back of the merge queue
  • Hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@neekolas neekolas marked this pull request as ready for review October 17, 2025 17:05
@neekolas neekolas requested review from a team as code owners October 17, 2025 17:05
@neekolas neekolas marked this pull request as draft October 17, 2025 17:06
@neekolas neekolas force-pushed the 10-16-add_rate_limiter_and_example branch 2 times, most recently from 9fcb7d7 to e17ada8 Compare October 17, 2025 17:17
@neekolas neekolas force-pushed the 10-16-add_rate_limiter_and_example branch from e17ada8 to a058ae5 Compare October 17, 2025 17:19
@neekolas neekolas force-pushed the 10-16-add_rate_limiter_and_example branch from a058ae5 to 66c3391 Compare October 17, 2025 17:22
@neekolas neekolas marked this pull request as ready for review October 17, 2025 23:00
@neekolas neekolas force-pushed the 10-16-add_rate_limiter_and_example branch 2 times, most recently from 3b8ab1d to 64201e5 Compare October 17, 2025 23:05
@neekolas neekolas force-pushed the 10-16-add_rate_limiter_and_example branch 2 times, most recently from 53fa0e6 to 472968e Compare October 22, 2025 20:07
@neekolas neekolas requested review from a team and removed request for a team October 22, 2025 20:07
@neekolas neekolas force-pushed the 10-16-add_rate_limiter_and_example branch from 472968e to 36bd494 Compare October 22, 2025 20:11
@neekolas neekolas force-pushed the 10-16-add_rate_limiter_and_example branch from 36bd494 to aeabe07 Compare October 28, 2025 21:17
@neekolas neekolas enabled auto-merge (squash) October 29, 2025 00:01
@neekolas neekolas merged commit e84d6ba into main Oct 29, 2025
12 of 13 checks passed
@neekolas neekolas deleted the 10-16-add_rate_limiter_and_example branch October 29, 2025 18:49
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.

3 participants