Skip to content

Commit

Permalink
ensure that we don't double sanitizer or _not_ sanitizer on parallel …
Browse files Browse the repository at this point in the history
…'first task' loads
  • Loading branch information
scbedd committed May 3, 2024
1 parent 4b1b0a3 commit e2b5e19
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,16 @@ 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
if (!session.IsSanitized)
lock (session)
{
session.IsSanitized = true;

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

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

Expand Down

0 comments on commit e2b5e19

Please sign in to comment.