-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Reduce HTTP timeout for mailcow API to 5 seconds #83
Conversation
Now attempts sometimes take ~8 secons instead of usual 1-2 seconds, which looks like a timeout and retry. But we better add more logging like #79 and see if timeouts occur. Hopefully this fixes the case when worker is killed because it did not respond at all within 60 second timeout. |
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.
Maybe, as the mailcow API seems to be a bit slow, it makes sense to do something like 10 seconds HTTP timeout and 105 seconds gunicorn worker timeout?
Or reduce the 10 tries to something less?
I would reduce it to 2 times. It makes sense to retry once in case of some middlebox (stateful firewall or whatever) hiccup, but if you fail two times it's better to report an error IMO. |
9343c3e
to
2d5d50b
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.
For instances with many users a larger timeout is necessary here, see other comments :)
requests timeout is the time a server is allowed not to respond at all, i.e. we only abort the connection if there is no byte received for this duration. For this purpose 30 seconds is too much, it is better to timeout after 5 seconds and restart from scratch. Otherwise within 60 seconds allowed for processing a single new_email requests we can only do 2 attempts, while the limit is 10 attempts.
2d5d50b
to
c569b1d
Compare
I rebased and updated the PR. |
CI says there is one lint complaint left, it wants two empty lines after
|
requests timeout is the time a server is allowed not to respond at all, i.e. we only abort the connection if there is no byte received for this duration. For this purpose 30 seconds is too much, it is better to timeout after 5 seconds and restart from scratch. Otherwise within 60 seconds allowed for processing a single new_email requests we can only do 2 attempts, while the limit is 10 attempts.