-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix: use correct context to close connection #127
fix: use correct context to close connection #127
Conversation
Signed-off-by: Denis Tingaikin <[email protected]>
@@ -186,7 +186,7 @@ func main() { | |||
} | |||
|
|||
defer func() { | |||
closeCtx, cancelClose := context.WithTimeout(ctx, rootConf.RequestTimeout) | |||
closeCtx, cancelClose := context.WithTimeout(context.Background(), rootConf.RequestTimeout) | |||
defer cancelClose() |
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.
Why context Background here?
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.
Because else the client will not close his connection.
Because ctx
will be done at the moment :)
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 can see not using the same context (as noted, it will be expired)... but we should have some timeout on the Close... perhaps note the amount of time left on the 'request' ctx and use that as duration for the new context for Close?
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 read this too quickly, this is exactly write as currently written.
Signed-off-by: Denis Tingaikin <[email protected]>
This PR syncs files with https://github.com/networkservicemesh/cmd-template Revision: https://github.com/networkservicemesh/cmd-template/commits/117d18197554b69cb2ceaf9a57563634940d5d22 commit 117d18197554b69cb2ceaf9a57563634940d5d22 Author: Nikita Skrynnik <[email protected]> Date: Thu Jan 18 20:14:40 2024 +1100 [qfix] delete tag param from create-release job (#127) Signed-off-by: Nikita Skrynnik <[email protected]> Signed-off-by: NSMBot <[email protected]>
Signed-off-by: Denis Tingaikin [email protected]