Skip to content

Commit 45d9c21

Browse files
authored
Merge branch 'master' into enh/list-licensed-items
2 parents e626639 + 791d9d1 commit 45d9c21

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/service-library/src/servicelib/tracing.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ def get_context() -> TracingContext:
2121

2222
@contextmanager
2323
def use_tracing_context(context: TracingContext):
24+
token: object | None = None
2425
if context is not None:
25-
otcontext.attach(context)
26+
token = otcontext.attach(context)
2627
try:
2728
yield
2829
finally:
29-
if context is not None:
30-
otcontext.detach(context)
30+
if token is not None:
31+
otcontext.detach(token)
3132

3233

3334
def setup_log_tracing(tracing_settings: TracingSettings):

0 commit comments

Comments
 (0)