From 32cd06239f3e371bb4e9c6f10d3062cbfde3f5be Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Mon, 11 Sep 2023 20:38:16 -0700 Subject: [PATCH] force the entire restore queue to a semaphore operation --- .../Store/GitStore.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStore.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStore.cs index a94dfde87f4..1c2e8171e22 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStore.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStore.cs @@ -172,15 +172,19 @@ public async Task Push(string pathToAssetsJson) { public async Task Restore(string pathToAssetsJson) { var config = await ParseConfigurationFile(pathToAssetsJson); - var initialized = IsAssetsRepoInitialized(config); - - if (!initialized) + var restoreQueue = InitTasks.GetOrAdd("restore", new TaskQueue()); + restoreQueue.Enqueue(async () => { - InitializeAssetsRepo(config); - } + var initialized = IsAssetsRepoInitialized(config); - CheckoutRepoAtConfig(config, cleanEnabled: true); - await BreadCrumb.Update(config); + if (!initialized) + { + InitializeAssetsRepo(config); + } + + CheckoutRepoAtConfig(config, cleanEnabled: true); + await BreadCrumb.Update(config); + }); return config.AssetsRepoLocation.ToString(); }