Skip to content

Commit

Permalink
Add default to _after_request_fn (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
gravelg authored and carlosalberto committed Jun 8, 2018
1 parent fcf20ad commit c003984
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flask_opentracing/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def _before_request_fn(self, attributes):

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

0 comments on commit c003984

Please sign in to comment.