Skip to content

Commit

Permalink
remove the necessity of always locking to check if a session is sanit…
Browse files Browse the repository at this point in the history
…ized
  • Loading branch information
scbedd committed Jul 26, 2024
1 parent 85384d4 commit 92b26ac
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -457,16 +457,19 @@ public async Task HandlePlaybackRequest(string recordingId, HttpRequest incoming

var sanitizers = SanitizerRegistry.GetSanitizers(session);

// we don't need to re-sanitize with recording-applicable sanitizers every time. just the very first one
lock (session)
if (!session.IsSanitized)
{
if (!session.IsSanitized)
// we don't need to re-sanitize with recording-applicable sanitizers every time. just the very first one
lock (session)
{
session.IsSanitized = true;

foreach (RecordedTestSanitizer sanitizer in sanitizers)
if (!session.IsSanitized)
{
session.Session.Sanitize(sanitizer);
foreach (RecordedTestSanitizer sanitizer in sanitizers)
{
session.Session.Sanitize(sanitizer);
}

session.IsSanitized = true;
}
}
}
Expand Down

0 comments on commit 92b26ac

Please sign in to comment.