markdown: Add another twitter code to retry-later.

Error code 131 is documented to be an arbitrary server error on
Twitter's side; add it to the retry list.
This commit is contained in:
Alex Vandiver 2020-08-17 13:16:18 -07:00 committed by Tim Abbott
parent 092ed87ae3
commit 5b74de7be7
1 changed files with 6 additions and 5 deletions

View File

@ -423,11 +423,12 @@ def fetch_tweet_data(tweet_id: str) -> Optional[Dict[str, Any]]:
# 63 is that the account is suspended, 179 is that # 63 is that the account is suspended, 179 is that
# it is now locked; cache the None. # it is now locked; cache the None.
return None return None
elif code in [88, 130]: elif code in [88, 130, 131]:
# Code 88 means that we were rate-limited and 130 # Code 88 means that we were rate-limited, 130
# means Twitter is having capacity issues; either way # means Twitter is having capacity issues, and 131
# just raise the error so we don't cache None and will # is other 400-equivalent; in these cases, raise
# try again later. # the error so we don't cache None and will try
# again later.
raise raise
# It's not clear what to do in cases of other errors, # It's not clear what to do in cases of other errors,
# but for now it seems reasonable to log at error # but for now it seems reasonable to log at error