-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add check context cancel #2596
add check context cancel #2596
Conversation
Signed-off-by: Kosuke Morimoto <[email protected]>
WalkthroughWalkthroughThe changes introduce a Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant Backoff
participant Context
Caller->>Backoff: Call Do()
Backoff->>Context: Wait for completion
alt Context Done
Context-->>Backoff: Context Done
Backoff->>Backoff: Check dctx.Err()
alt Deadline Exceeded
Backoff-->>Caller: Return timeout error
else Context Canceled
Backoff-->>Caller: Return original error
else Other Error
Backoff-->>Caller: Return combined error
end
else Continue Execution
Backoff-->>Caller: Continue processing
end
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
[CHATOPS:HELP] ChatOps commands.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2596 +/- ##
==========================================
- Coverage 24.36% 24.35% -0.02%
==========================================
Files 531 531
Lines 45867 45880 +13
==========================================
- Hits 11177 11173 -4
- Misses 33939 33958 +19
+ Partials 751 749 -2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- internal/backoff/backoff.go (1 hunks)
Additional context used
GitHub Check: codecov/patch
internal/backoff/backoff.go
[warning] 196-198: internal/backoff/backoff.go#L196-L198
Added lines #L196 - L198 were not covered by tests
[warning] 202-203: internal/backoff/backoff.go#L202-L203
Added lines #L202 - L203 were not covered by tests
Additional comments not posted (1)
internal/backoff/backoff.go (1)
194-203
: Context error handling is robust and well-implemented.The handling of different context errors (
context.DeadlineExceeded
andcontext.Canceled
) within theselect
statement is appropriately managed. The use oferrors.Join
for other errors is a good practice as it preserves the context of the original error, which is crucial for debugging and error resolution.Tools
GitHub Check: codecov/patch
[warning] 196-198: internal/backoff/backoff.go#L196-L198
Added lines #L196 - L198 were not covered by tests
[warning] 202-203: internal/backoff/backoff.go#L202-L203
Added lines #L202 - L203 were not covered by tests
Signed-off-by: Kosuke Morimoto <[email protected]>
Deploying vald with Cloudflare Pages
|
Signed-off-by: Kosuke Morimoto <[email protected]>
Signed-off-by: Kosuke Morimoto <[email protected]>
Signed-off-by: Kosuke Morimoto <[email protected]>
Signed-off-by: Kosuke Morimoto <[email protected]>
Signed-off-by: Kosuke Morimoto <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- internal/backoff/backoff.go (1 hunks)
Additional context used
GitHub Check: codecov/patch
internal/backoff/backoff.go
[warning] 189-198: internal/backoff/backoff.go#L189-L198
Added lines #L189 - L198 were not covered by tests
Signed-off-by: Kosuke Morimoto <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- internal/backoff/backoff.go (1 hunks)
Additional comments not posted (1)
internal/backoff/backoff.go (1)
189-204
: Confirm handling of context states and suggest enhancements.The handling of context states using the
select
statement is robust and well-implemented. However, as previously suggested, consider enhancing the logging for the default case to aid in debugging when neitherDeadlineExceeded
norCanceled
errors occur.Additionally, it is crucial to ensure that these new lines are covered by tests, especially given their importance in handling context cancellation and deadline expiration. The static analysis warning indicates that these lines are not currently covered by tests, which poses a risk to the reliability of this functionality.
Consider adding more detailed logging for the default case:
case <-dctx.Done(): switch dctx.Err() { case context.DeadlineExceeded: log.Debugf("[backoff]\tfor: "+name+",\tDeadline Exceeded\terror: %v", err.Error()) return nil, errors.ErrBackoffTimeout(err) case context.Canceled: log.Debugf("[backoff]\tfor: "+name+",\tCanceled\terror: %v", err.Error()) return nil, err default: log.Debugf("[backoff]\tfor: "+name+",\tUnknown context error\terror: %v", err.Error()) return nil, errors.Join(dctx.Err(), err) }If you need assistance with generating the test cases to cover these scenarios, I can help.
Likely invalid or redundant comment.
Signed-off-by: Kosuke Morimoto <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
* add check context cancel Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * update deps Signed-off-by: Kosuke Morimoto <[email protected]> --------- Signed-off-by: Kosuke Morimoto <[email protected]> Co-authored-by: Yusuke Kato <[email protected]>
* add check context cancel Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * update deps Signed-off-by: Kosuke Morimoto <[email protected]> --------- Signed-off-by: Kosuke Morimoto <[email protected]> Co-authored-by: Yusuke Kato <[email protected]>
* add check context cancel Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * fix Signed-off-by: Kosuke Morimoto <[email protected]> * update deps Signed-off-by: Kosuke Morimoto <[email protected]> --------- Signed-off-by: Kosuke Morimoto <[email protected]> Co-authored-by: Yusuke Kato <[email protected]>
Description
Fix unstable unit test result.
Related Issue
Versions
Checklist
Special notes for your reviewer
Summary by CodeRabbit
New Features
Bug Fixes
Chores
1.23.0
to1.23.1
, indicating minor improvements.