Skip to content

Commit

Permalink
more effective lock utilization
Browse files Browse the repository at this point in the history
  • Loading branch information
scbedd committed Jul 29, 2024
1 parent 1e7a071 commit c3af4b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
10 changes: 10 additions & 0 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/RecordSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,15 @@ public void Sanitize(RecordedTestSanitizer sanitizer)
sanitizer.Sanitize(this);
}
}
public void Sanitize(IEnumerable<RecordedTestSanitizer> sanitizers)
{
lock (Entries)
{
foreach(var sanitizer in sanitizers)
{
sanitizer.Sanitize(this);
}
}
}
}
}
12 changes: 2 additions & 10 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,7 @@ public void StopRecording(string sessionId, IDictionary<string, string> variable
}

var sanitizers = SanitizerRegistry.GetSanitizers(recordingSession);

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

if (variables != null)
{
Expand Down Expand Up @@ -464,11 +460,7 @@ public async Task HandlePlaybackRequest(string recordingId, HttpRequest incoming
{
if (!session.IsSanitized)
{
foreach (RecordedTestSanitizer sanitizer in sanitizers)
{
session.Session.Sanitize(sanitizer);
}

session.Session.Sanitize(sanitizers);
session.IsSanitized = true;
}
}
Expand Down

0 comments on commit c3af4b5

Please sign in to comment.