Explorar el Código

Error when the retries are exceeded

tags/v0.2.0
JustAnotherArchivist hace 4 años
padre
commit
6fafd32685
Se han modificado 3 ficheros con 7 adiciones y 1 borrados
  1. +3
    -0
      qwarc/__init__.py
  2. +3
    -0
      qwarc/const.py
  3. +1
    -1
      qwarc/utils.py

+ 3
- 0
qwarc/__init__.py Ver fichero

@@ -95,6 +95,9 @@ class Item:
method = 'GET'
data = None
attempt = 0
elif action == ACTION_RETRIES_EXCEEDED:
logging.error(f'Request for {url} failed {attempt} times')
return response, tuple(history)
elif action == ACTION_RETRY:
# Nothing to do, just go to the next cycle
pass


+ 3
- 0
qwarc/const.py Ver fichero

@@ -21,3 +21,6 @@ ACTION_RETRY = 2
ACTION_FOLLOW_OR_SUCCESS = 3
'''If the response contains a Location or URI header, follow it. Otherwise, treat it as a success.'''
#TODO: Rename to ACTION_FOLLOW maybe? However, the current name makes it more clear what qwarc does when there's a redirect without a redirect target...

ACTION_RETRIES_EXCEEDED = 4
'''This request failed repeatedly and exceeded the retry limit.'''

+ 1
- 1
qwarc/utils.py Ver fichero

@@ -178,6 +178,6 @@ def handle_response_limit_error_retries(maxRetries, handler = handle_response_de
async def _handler(url, attempt, response, exc):
action, writeToWarc = await handler(url, attempt, response, exc)
if action == ACTION_RETRY and attempt > maxRetries:
action = ACTION_IGNORE
action = ACTION_RETRIES_EXCEEDED
return action, writeToWarc
return _handler

Cargando…
Cancelar
Guardar