Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove the other prototypes
  • Loading branch information
scbedd committed Jul 31, 2024
commit 2e03b09b6d5ebc72397cb2779bc7e6ddc5d5459e
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,6 @@ public void Record(RecordEntry entry)
}
}

public RecordEntry NonLockingLookup(RecordEntry requestEntry, RecordMatcher matcher, IEnumerable<RecordedTestSanitizer> sanitizers, string sessionId = null)
{
foreach (RecordedTestSanitizer sanitizer in sanitizers)
{
sanitizer.Sanitize(requestEntry);
}
// normalize request body with STJ using relaxed escaping to match behavior when Deserializing from session files
RecordEntry.NormalizeJsonBody(requestEntry.Request);

RecordEntry entry = matcher.FindMatch(requestEntry, Entries);

return entry;
}

public RecordEntry Lookup(RecordEntry requestEntry, RecordMatcher matcher, IEnumerable<RecordedTestSanitizer> sanitizers, bool remove = true, string sessionId = null)
{
foreach (RecordedTestSanitizer sanitizer in sanitizers)
Expand All @@ -105,30 +91,19 @@ public RecordEntry Lookup(RecordEntry requestEntry, RecordMatcher matcher, IEnum
// normalize request body with STJ using relaxed escaping to match behavior when Deserializing from session files
RecordEntry.NormalizeJsonBody(requestEntry.Request);

lock (Entries)
RecordEntry entry = matcher.FindMatch(requestEntry, Entries);
if (remove)
{
RecordEntry entry = matcher.FindMatch(requestEntry, Entries);
if (remove)
{
Entries.Remove(entry);
DebugLogger.LogInformation($"We successfully matched and popped request URI {entry.RequestUri} for recordingId {sessionId}");
}

return entry;
Entries.Remove(entry);
DebugLogger.LogInformation($"We successfully matched and popped request URI {entry.RequestUri} for recordingId {sessionId}");
}
}

public void NonLockingRemove(RecordEntry entry)
{
Entries.Remove(entry);
return entry;
}

public void Remove(RecordEntry entry)
{
lock (Entries)
{
Entries.Remove(entry);
}
Entries.Remove(entry);
}

public void Sanitize(RecordedTestSanitizer sanitizer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public async Task HandlePlaybackRequest(string recordingId, HttpRequest incoming
lock (session.Session.Entries)
{
// Session may be removed later, but only after response has been fully written
var match = session.Session.NonLockingLookup(entry, session.CustomMatcher ?? Matcher, sanitizers, sessionId: recordingId);
var match = session.Session.Lookup(entry, session.CustomMatcher ?? Matcher, sanitizers, remove: false, sessionId: recordingId);

foreach (ResponseTransform transform in Transforms.Concat(session.AdditionalTransforms))
{
Expand Down Expand Up @@ -517,7 +517,7 @@ public async Task HandlePlaybackRequest(string recordingId, HttpRequest incoming

if (remove)
{
session.Session.NonLockingRemove(match);
session.Session.Remove(match);
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,6 @@ public void ConfigureServices(IServiceCollection services)

public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
int maxWorkerThreads, maxCompletionPortThreads;
ThreadPool.GetMaxThreads(out maxWorkerThreads, out maxCompletionPortThreads);
System.Console.WriteLine($"Default max worker threads: {maxWorkerThreads}");
System.Console.WriteLine($"Default max completion port threads: {maxCompletionPortThreads}");



if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
Expand Down