-
Notifications
You must be signed in to change notification settings - Fork 284
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
api (ticdc): check http request context in api helper #11165
api (ticdc): check http request context in api helper #11165
Conversation
Signed-off-by: dongmen <414110582@qq.com>
@@ -551,5 +579,9 @@ func (h APIV2HelpersImpl) getVerifiedTables( | |||
return nil, nil, err | |||
} | |||
|
|||
if ctx.Err() != nil { |
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.
Perhaps the redundant code can be reduced through a common ctxChecker
function? eg:
func ctxChecker(ctx, fn func() error) {
if fn() != nil {
return nil, errors.Trace(err)
}
if ctx.Err() != nil {
return nil, errors.Trace(ctx.Err())
}
}
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.
I prefer to write them each time in the api_helpers.go
because it is more straightforward.
/retest |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #11165 +/- ##
================================================
- Coverage 57.6254% 57.6232% -0.0023%
================================================
Files 849 849
Lines 125934 125951 +17
================================================
+ Hits 72570 72577 +7
- Misses 47966 47975 +9
- Partials 5398 5399 +1 |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CharlesCheung96, sdojjy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
/retest |
…feed_api_error_message
/retest |
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
Issue Number: close #11046
What is changed and how it works?
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note