Skip to content

Commit

Permalink
Fix: also count a download as failed if the connection is lost
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueBrain committed Feb 11, 2024
1 parent 3fcdb4b commit 3a6d421
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bananas_server/application/bananas_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,14 @@ async def receive_PACKET_CONTENT_CLIENT_CONTENT(self, source, content_infos):
filename=safe_filename(content_entry),
stream=stream,
)
except asyncio.CancelledError:
stats_download_failed.labels(
content_type=get_folder_name_from_content_type(content_entry.content_type),
version=get_version_from_source(source),
).inc()

# Our coroutine is cancelled, pass it on the the caller.
raise
except StreamReadError:
stats_download_failed.labels(
content_type=get_folder_name_from_content_type(content_entry.content_type),
Expand Down

0 comments on commit 3a6d421

Please sign in to comment.