-
Notifications
You must be signed in to change notification settings - Fork 59
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: more informative request canceling #407
api: more informative request canceling #407
Conversation
a8898f5
to
06ed7f8
Compare
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.
Thank you for the patch! I would like to use a more general request ID
, request id
or just request
instead of requestId
that refers to the internal implementation.
Co-authored-by: Oleg Jukovec <[email protected]>
67d0561
to
e76c795
Compare
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.
Thank you for the patch! Please, squash commits into one.
Please, fix the linter error: It should be enough:
|
25033b7
to
577a38c
Compare
I have fixed linter error and squashed commits into single commit. |
Thank you. Let's wait a bit for a second reviewer and I'll merge. |
@@ -47,6 +48,8 @@ type Member struct { | |||
Val uint | |||
} | |||
|
|||
var contextDoneErrRegexp = regexp.MustCompile(`^context is done \(request ID [0-9]+\)$`) |
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'm a little confused by the use of regular expressions to calculate the error type. regexp is slow compared to errors.Is. Why can't we use the errors.Is construct in this case?
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.
We could extend the ClientError & errors.As to catch it:
Lines 25 to 30 in 0ccdee2
// ClientError is connection error produced by this client, | |
// i.e. connection failures or timeouts. | |
type ClientError struct { | |
Code uint32 | |
Msg string | |
} |
Lines 55 to 64 in 0ccdee2
// Tarantool client error codes. | |
const ( | |
ErrConnectionNotReady = 0x4000 + iota | |
ErrConnectionClosed = 0x4000 + iota | |
ErrProtocolError = 0x4000 + iota | |
ErrTimeouted = 0x4000 + iota | |
ErrRateLimited = 0x4000 + iota | |
ErrConnectionShutdown = 0x4000 + iota | |
ErrIoError = 0x4000 + iota | |
) |
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.
Since it's tests, there is no performance issue is questioned. So using regexp is ok here.
Returning here a ClientError or something else changes API.
I'm not intended to change the existing API, I'm intended just to make more informative the existing one (to avoid misleading and questions by users of library in the future).
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.
Thanks for the patch!
Log the probable reason for unexpected requestId. Add requestId info to context done error message.
577a38c
to
d42b1b8
Compare
Log the probable reason for unexpected requestId.
Add requestId info to context done error message.
What has been done? Why? What problem is being solved?
I didn't forget about (remove if it is not applicable):
Related issues: