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

Allow RESPONSE_TIMEOUT to be disabled #2489

Open
GabrielCappelli opened this issue Jun 28, 2022 · 6 comments
Open

Allow RESPONSE_TIMEOUT to be disabled #2489

GabrielCappelli opened this issue Jun 28, 2022 · 6 comments

Comments

@GabrielCappelli
Copy link

GabrielCappelli commented Jun 28, 2022

Is your feature request related to a problem? Please describe.
I would like to be able to disable RESPONSE_TIMEOUT so I can have long requests running until completion.

Describe the solution you'd like
A common solution to disable timeouts is to set the value to 0.

Additional context
N/A

@GabrielCappelli GabrielCappelli changed the title Allow REPONSE_TIMEOUT to be disabled Allow RESPONSE_TIMEOUT to be disabled Jun 28, 2022
@ahopkins
Copy link
Member

@Tronic and I have talked about an overhaul to timeouts. This is not going to land in the upcoming release, but is absolutely something I'm hoping to get into the end of Summer release.

@Tronic
Copy link
Member

Tronic commented Jun 29, 2022

@GabrielCappelli Setting to float('inf') should do the trick.

@Tronic
Copy link
Member

Tronic commented Jun 29, 2022

Zero to denote infinity is IMO a bad idea, even if many do it. I've seen inf used quite a bit for this on Python, but None could also work.

@GabrielCappelli
Copy link
Author

GabrielCappelli commented Jun 29, 2022

Thanks for the responses. The float('inf') can do the trick for us with current implementation.

I think the only warning with using inf is that if you use it on all three timeouts (request, response and keep_alive) you'll schedule a call_later to inf, which I believe would leak some memory over time.

We're only interested in disabling the RESPONSE_TIMEOUT so it should be fine for our use case.

@Tronic
Copy link
Member

Tronic commented Jun 30, 2022

I believe the timeout polling function is canceled at the end of the connection, but granted, it could be entirely avoided when there are no timeouts at all. However, the no timeout situation should also be quite rare as it makes it trivial to crash your server if you don't implement timeouts or other limits yourself or externally.

@ahopkins
Copy link
Member

Yeah, I've thought about this in the past about how we could implement per-endpoint overrides. The difficulty is that the timers live outside of routing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants