-
Notifications
You must be signed in to change notification settings - Fork 16
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
pkg/sqlutil: queryLogger must handle non-positive timeouts and inspect context errors; support custom timing thresholds #530
Conversation
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.
nit/ typo in PR name "timoeouts"
a2f000d
to
7a332d4
Compare
7a332d4
to
5072110
Compare
5072110
to
8ba5ea9
Compare
22f4feb
to
8d938d2
Compare
if t == nil { | ||
return ctx | ||
} | ||
return context.WithValue(ctx, ctxKeyLogThresholds{}, *t) |
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.
Cool! Glad to see us using values in contexts finally, I've wondered why we don't use them more.
Although I hope this won't interfere with any future use of them. If some component needs to have a value attached to a context, but also needs it to have a deadline with custom thresholds, is there a clean way for those to co-exist?
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.
The context key used here is an unexported type, so nothing outside of this package can use the same key and conflict with it.
8d938d2
to
3154f0c
Compare
3154f0c
to
e330f6e
Compare
…ustom timing thresholds
e330f6e
to
46c02a1
Compare
https://smartcontract-it.atlassian.net/browse/BCF-3245
Handle non-positive timeouts gracefully and inspect the context error. In the case of cancelled or unknown error, just return. Only try to calculate how much of the timeout was used for success and explicit
context.DeadlineExceeded
.https://smartcontract-it.atlassian.net/browse/BCF-3252
Support customizable thresholds via context values.
Supports: