Skip to content

Commit c003984

Browse files
gravelgcarlosalberto
authored andcommitted
Add default to _after_request_fn (#6)
1 parent fcf20ad commit c003984

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

flask_opentracing/tracer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def _before_request_fn(self, attributes):
9292

9393
def _after_request_fn(self):
9494
request = stack.top.request
95-
span = self._current_spans.pop(request)
95+
# the pop call can fail if the request is interrupted by a `before_request` method so we need a default
96+
span = self._current_spans.pop(request, None)
9697
if span is not None:
9798
span.finish()

0 commit comments

Comments
 (0)