Skip to content
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

[Support Question] Server IdleTimeout vs context.WithTimeout.timeout #34932

Closed
bentcoder opened this issue Oct 16, 2019 · 1 comment
Closed

Comments

@bentcoder
Copy link

Hi,

Am I correct to assume that server IdleTimeout argument can be used for context WithTimeout 'timeout' argument?

Thanks

srv := &http.Server{Addr: ":8080", Handler: nil, IdleTimeout: 10}

// Graceful server shutdown steps handled here on
....
....
ctx, cancel := context.WithTimeout(context.Background(), srv.IdleTimeout*time.Second)
defer cancel()
....
....
go version go1.13.1 darwin/amd64
@mdlayher
Copy link
Member

Please see https://github.com/golang/go/wiki/Questions for a list of places to seek help. Closing.

@golang golang locked and limited conversation to collaborators Oct 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants