forked from fl00r/go-tarantool-1.6
-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Setup: http server, making tarantool requests with context cancelation.
When connection closed from client side, request context.Context canceled. Such errors like context.Canceled are handled by out side, and converting to response with 499 status code.
Problem:
One of ctx.Done() handlers - https://github.com/tarantool/go-tarantool/blob/master/connection.go#L987
Connector returns own error on finished context. This is not static err, and it is a tricky kind to handle it. This leads to wrong 500 status code errors in logs and metrics.
Proposal:
Return a wrapped context.Cause result, for example:
select {
case <-ctx.Done():
fut.SetError(fmt.Errorf("context is done (request ID %d): %w", fut.requestId, context.Cause(ctx)))
}
This will allow to handle internal context error or custom, given from context.WithCancelCause
cancel func.
Metadata
Metadata
Assignees
Labels
No labels