Skip to content

Commit

Permalink
[bugfix] Fix AttributeError on timeouts
Browse files Browse the repository at this point in the history
Bug: T345023
Change-Id: I870ad9f45821a9f309d5f51ba5d80100a9573fd0
  • Loading branch information
xqt committed Aug 26, 2023
1 parent b522ac9 commit 5418b14
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pywikibot/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ def wait(self, delay: Optional[int] = None) -> None:
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)
Expand Down

0 comments on commit 5418b14

Please sign in to comment.