Skip to content

Commit

Permalink
Merge pull request #78 from nenoNaninu/f/refactor_use_trace_context2
Browse files Browse the repository at this point in the history
refactor
  • Loading branch information
nenoNaninu authored Jan 27, 2025
2 parents 5fc8da3 + e1753d3 commit 9f86402
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ public async Task OnDisconnectedAsync(
{
var previousActivity = Activity.Current;

if (previousActivity is not null && !_options.UseParentTraceContext)
var shouldClearParentTraceContext = previousActivity is not null && !_options.UseParentTraceContext;

if (shouldClearParentTraceContext)
{
Activity.Current = null;
}
Expand Down Expand Up @@ -173,8 +175,9 @@ public async Task OnDisconnectedAsync(
}
finally
{
if (previousActivity is not null && !_options.UseParentTraceContext)
if (shouldClearParentTraceContext)
{
// restore previous activity
Activity.Current = previousActivity;
}
}
Expand Down

0 comments on commit 9f86402

Please sign in to comment.