diff --git a/docs/configuration.rst b/docs/configuration.rst index 5854c4b2..217aeab5 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -723,9 +723,6 @@ extractor.deviantart.wait-min Type ``integer`` Default ``0`` Description Minimum wait time in seconds before API requests. - - Note: This value will internally be rounded up - to the next power of 2. =========== ===== diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py index 7f14c030..0e67330c 100644 --- a/gallery_dl/downloader/http.py +++ b/gallery_dl/downloader/http.py @@ -87,7 +87,7 @@ class HttpDownloader(DownloaderBase): self.log.warning("%s (%s/%s)", msg, tries, self.retries+1) if tries > self.retries: return False - time.sleep(min(2 ** (tries-1), 1800)) + time.sleep(tries) tries += 1 headers = {} diff --git a/gallery_dl/extractor/common.py b/gallery_dl/extractor/common.py index e6c0968c..5e877005 100644 --- a/gallery_dl/extractor/common.py +++ b/gallery_dl/extractor/common.py @@ -123,7 +123,7 @@ class Extractor(): self.log.debug("%s (%s/%s)", msg, tries, retries+1) if tries > retries: break - time.sleep(min(2 ** (tries-1), 1800)) + time.sleep(tries) tries += 1 raise exception.HttpError(msg, response) diff --git a/gallery_dl/extractor/deviantart.py b/gallery_dl/extractor/deviantart.py index 73ef20da..1efd1d55 100644 --- a/gallery_dl/extractor/deviantart.py +++ b/gallery_dl/extractor/deviantart.py @@ -14,7 +14,6 @@ from ..cache import cache, memcache import collections import itertools import mimetypes -import math import time import re @@ -837,8 +836,7 @@ class DeviantartOAuthAPI(): self.log = extractor.log self.headers = {} - delay = extractor.config("wait-min", 0) - self.delay = math.ceil(math.log2(delay)) if delay >= 1 else -1 + self.delay = extractor.config("wait-min", 0) self.delay_min = max(2, self.delay) self.mature = extractor.config("mature", "true") @@ -993,8 +991,8 @@ class DeviantartOAuthAPI(): """Call an API endpoint""" url = "https://www.deviantart.com/api/v1/oauth2/" + endpoint while True: - if self.delay >= 0: - time.sleep(2 ** self.delay) + if self.delay: + time.sleep(self.delay) self.authenticate(None if public else self.refresh_token_key) response = self.extractor.request( @@ -1015,9 +1013,9 @@ class DeviantartOAuthAPI(): msg = "API responded with {} {}".format( status, response.reason) if status == 429: - if self.delay < 9: + if self.delay < 30: self.delay += 1 - self.log.warning("%s. Using %ds delay.", msg, 2 ** self.delay) + self.log.warning("%s. Using %ds delay.", msg, self.delay) else: self.log.error(msg) return data