Skip to content

Commit

Permalink
Fix warnings about finish() after disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Mar 23, 2020
1 parent b09dc68 commit 6f36624
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/84.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix warnings about finish() after disconnect.
4 changes: 3 additions & 1 deletion sygnal/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ async def _handle_dispatch(self, root_span, request, log, notif, context):
request.setResponseCode(500)
log.error("Exception whilst dispatching notification.", exc_info=True)
finally:
request.finish()
if not request._disconnected:
request.finish()

PUSHGATEWAY_HTTP_RESPONSES_COUNTER.labels(code=request.code).inc()
root_span.set_tag(tags.HTTP_STATUS_CODE, request.code)

Expand Down

0 comments on commit 6f36624

Please sign in to comment.