diff --git a/kibun/__init__.py b/kibun/__init__.py index 868e063..a83b33b 100644 --- a/kibun/__init__.py +++ b/kibun/__init__.py @@ -28,6 +28,10 @@ async def kibun_loop(tasks, semaphore_number=1): if task_result.success: continue + # Do not retry task if it's failed with non retry status + if task_result.status not in task_result.task.retry_status: + continue + # Stop after task failed more than max_fails if task_result.task.max_fails is not None: if task_result.task.fails > task_result.task.max_fails: diff --git a/kibun/backend/aio/request.py b/kibun/backend/aio/request.py index ae68084..8017dcc 100644 --- a/kibun/backend/aio/request.py +++ b/kibun/backend/aio/request.py @@ -76,7 +76,7 @@ async def request_aio(session, endpoint, task): attempts += 1 # There is no need to spam generic error messages - if status not in [constants.NETWORK_ERROR]: + if status not in task.retry_status: logger.error(f"Request failed {endpoint} {status} ({attempts})") if task.sleep > 0: