Skip to content

Commit

Permalink
fix: Exception and no retry when failing on DNS error
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Nov 7, 2024
1 parent 94dce77 commit 24990fc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lacuscore/lacuscore.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,10 @@ async def _capture(self, uuid: str, priority: int) -> None:
logger.warning(f'Settings invalid: {e}')
raise CaptureSettingsError('Invalid settings', e)

# If the class is initialized with max_retries below the one provided in the settings, we use the lowest value
# NOTE: make sure the variable is initialized *before* we raise any RetryCapture
max_retries = min([to_capture.max_retries, self.max_retries]) if to_capture.max_retries is not None else self.max_retries

if to_capture.document:
# we do not have a URL yet.
document_as_bytes = b64decode(to_capture.document)
Expand Down Expand Up @@ -474,8 +478,6 @@ async def _capture(self, uuid: str, priority: int) -> None:
cookie['path'] = '/'
cookies.append(cookie)

# If the class is initialized with max_retries below the one provided in the settings, we use the lowest value
max_retries = min([to_capture.max_retries, self.max_retries]) if to_capture.max_retries is not None else self.max_retries
try:
logger.debug(f'Capturing {url}')
stats_pipeline.sadd(f'stats:{today}:captures', url)
Expand Down

0 comments on commit 24990fc

Please sign in to comment.