Conversation
Adds a unary server interceptor that applies a configurable default deadline (60s) to incoming gRPC requests that arrive without one. Requests with an existing deadline are left unchanged. The interceptor is inserted as the first ColdBrew interceptor in the default chain, before ResponseTimeLoggingInterceptor. - SetDefaultTimeout(d) setter for programmatic config - 0 disables the interceptor (pass-through) - 4 new tests covering: applies timeout, existing deadline preserved, disabled mode, chain inclusion
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 7 minutes and 17 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a new unary server interceptor to enforce a default deadline for inbound gRPC calls that arrive without one, improving safety for gRPC-gateway/HTTP->gRPC paths that currently don’t set deadlines.
Changes:
- Introduces
DefaultTimeoutInterceptor()which applies a configurable default timeout (60s by default) only when the incoming context has no deadline. - Adds
SetDefaultTimeout(time.Duration)to configure/disable the behavior (0disables). - Wires the interceptor into
DefaultInterceptors()and adds unit tests covering behavior and chain placement; updates generated README docs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| README.md | Documents the new interceptor and setter in the generated API reference. |
| interceptors.go | Adds global defaultTimeout, setter, new interceptor, and inserts it into the default unary interceptor chain. |
| interceptors_test.go | Adds tests for default-timeout application, preservation of existing deadlines, disable behavior, and inclusion in the default chain. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds config field and wiring for the DefaultTimeoutInterceptor introduced in interceptors. The env var defaults to 60 seconds; set to 0 to disable. Depends on go-coldbrew/interceptors#37.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
DefaultTimeoutInterceptor— applies a 60s default deadline to incoming unary gRPC requests that arrive without oneResponseTimeLoggingInterceptorSetDefaultTimeout(d)setter for programmatic config;0disables (pass-through)Test plan
TestDefaultTimeoutInterceptor_AppliesTimeout— no deadline → handler sees ~60s deadlineTestDefaultTimeoutInterceptor_ExistingDeadline— caller's deadline preservedTestDefaultTimeoutInterceptor_Disabled—SetDefaultTimeout(0)→ no deadline addedTestDefaultInterceptors_IncludesTimeout— first CB interceptor sets deadlinemake testpasses with-racemake lintclean (0 issues, no vulnerabilities)