jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/952520 )
Change subject: [bugfix] Fix AttributeError on timeouts ......................................................................
[bugfix] Fix AttributeError on timeouts
Bug: T345023 Change-Id: I870ad9f45821a9f309d5f51ba5d80100a9573fd0 --- M pywikibot/data/__init__.py 1 file changed, 14 insertions(+), 4 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/__init__.py b/pywikibot/data/__init__.py index 1dd0b02..53e3a1c 100644 --- a/pywikibot/data/__init__.py +++ b/pywikibot/data/__init__.py @@ -38,15 +38,15 @@ if not hasattr(self, 'retry_wait'): self.retry_wait = pywikibot.config.retry_wait
- if self.current_retries > self.max_retries: - raise pywikibot.exceptions.TimeoutError( - 'Maximum retries attempted without success.') - if not hasattr(self, 'current_retries'): self.current_retries = 1 else: self.current_retries += 1
+ if self.current_retries > self.max_retries: + raise pywikibot.exceptions.TimeoutError( + 'Maximum retries attempted without success.') + # double the next wait, but do not exceed config.retry_max seconds delay = delay or self.retry_wait delay *= 2 ** (self.current_retries - 1)