From e2b5e1919dcc4013b12a2cd2894ae4e73880d7a1 Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Fri, 3 May 2024 12:01:59 -0700 Subject: [PATCH] ensure that we don't double sanitizer or _not_ sanitizer on parallel 'first task' loads --- .../Azure.Sdk.Tools.TestProxy/RecordingHandler.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs index 3d39a4f41ba..7037997394a 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs @@ -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); + } } }