Skip to content

Commit

Permalink
force the entire restore queue to a semaphore operation
Browse files Browse the repository at this point in the history
  • Loading branch information
scbedd committed Sep 12, 2023
1 parent c2613da commit 32cd062
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,19 @@ public async Task Push(string pathToAssetsJson) {
public async Task<string> 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();
}
Expand Down

0 comments on commit 32cd062

Please sign in to comment.