Skip to content

Commit 3d63842

Browse files
committed
fix: Finish span if caller didnt yet
1 parent 3eb206e commit 3d63842

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

sentry_sdk/hub.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,15 +408,15 @@ def start_trace(self, **kwargs):
408408
return span
409409

410410
def finish_trace(self, span):
411+
if span.timestamp is None:
412+
# This transaction is not yet finished so we just finish it.
413+
span.finish()
414+
411415
if span.transaction is None:
412416
# If this has no transaction set we assume there's a parent
413417
# transaction for this span that would be flushed out eventually.
414418
return None
415419

416-
if span.timestamp is None:
417-
# This transaction is not yet finished so we just discard it.
418-
return None
419-
420420
if self.client is None:
421421
# We have no client and therefore nowhere to send this transaction
422422
# event.

0 commit comments

Comments
 (0)