Skip to content

Commit

Permalink
detect HTML code != 200 and log ERROR rather than creating fake downl…
Browse files Browse the repository at this point in the history
…oads
  • Loading branch information
pjjin-design committed Dec 6, 2024
1 parent 3db05fc commit c07c2f8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions wis2downloader/downloader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ def process_job(self, job) -> None:
response = None
try:
response = self.http.request('GET', _url)
# Check the response status code
if response.status != 200:
LOGGER.error(f"Error downloading {_url}, received status code: {response.status}")
# Increment failed download counter
FAILED_DOWNLOADS.labels(topic=topic, centre_id=centre_id).inc(1)
return
# Get the filesize in KB
filesize = len(response.data)
except Exception as e:
Expand Down

0 comments on commit c07c2f8

Please sign in to comment.