Use generic HTTP retry policy by default and rename dedicated decorator
Instead of retrying HTTP requests only for 429 status code by default, prefer to use the generic retry policy enabling to also retry for status codes >= 500 but also on ConnectionError exceptions. Rename throttling_retry decorator to http_retry to reflect this change.
This commit is contained in:
parent
9b3e565cf7
commit
9c55acd286
23 changed files with 71 additions and 62 deletions
|
@ -16,7 +16,7 @@ from bs4 import BeautifulSoup
|
|||
import requests
|
||||
from tenacity.before_sleep import before_sleep_log
|
||||
|
||||
from swh.lister.utils import throttling_retry
|
||||
from swh.lister.utils import http_retry
|
||||
from swh.model.hashutil import hash_to_hex
|
||||
from swh.scheduler.interface import SchedulerInterface
|
||||
from swh.scheduler.model import ListedOrigin
|
||||
|
@ -132,7 +132,7 @@ class ArchLister(StatelessLister[ArchListerPage]):
|
|||
}
|
||||
)
|
||||
|
||||
@throttling_retry(before_sleep=before_sleep_log(logger, logging.WARNING))
|
||||
@http_retry(before_sleep=before_sleep_log(logger, logging.WARNING))
|
||||
def request_get(self, url: str, params: Dict[str, Any]) -> requests.Response:
|
||||
|
||||
logger.debug("Fetching URL %s with params %s", url, params)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue