From 92b26acfbe853d61e69bfea69c2fa40d5164c406 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Fri, 26 Jul 2024 10:44:12 -0700 Subject: [PATCH] remove the necessity of always locking to check if a session is sanitized --- .../RecordingHandler.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs index 5e033feaa7a..08511273dd8 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/RecordingHandler.cs @@ -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; } } }