Retry setMyCommands on timeout during startup - #170
Merged
Conversation
A transient httpx read timeout on one of the 17 back-to-back setMyCommands
calls at startup permanently dropped that language's command menu for the
pod's lifetime ("Failed to set ja commands"). The bare warning also logged
no cause, since exc_info was omitted.
Retry once after a short sleep on TimedOut, and log the exception for both
the localised and admin branches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Startup log from the live pod:
A 5s gap, one warning, then everything after it succeeds. Not a 400 and not a
content rejection β the
jacatalog is valid andgetMyCommands?language_code=jareturns the full Japanese menu. It's a transient httpx read timeout on one
request out of 17 back-to-back
setMyCommandscalls fired at startup.Two issues that made it worse than it looks:
command menu for the pod's entire lifetime (commands are only set in
post_init).logger.warning("Failed to set %s commands", lang_code)had noexc_info,so the warning gave no cause at all.
Change
One
_set_commands_retryinghelper that retries once after a 2s sleep onTimedOut. Both the localised loop and the admin loop route through it, andboth warnings now carry
exc_info=True.Test
Added
test_timeout_is_retriedβ first localised call raisesTimedOut, assertsthe retry brings the total call count to
2 + n_localised. 9 tests pass, ruffclean.