Skip to content

Commit

Permalink
Force entire Restore operation to enqueued (#6948)
Browse files Browse the repository at this point in the history
* force the entire restore queue to a semaphore operation
* we must ensure to use the proper Enqueue method!
  • Loading branch information
scbedd authored Sep 12, 2023
1 parent fb6062a commit c3f571b
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());
await restoreQueue.EnqueueAsync(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 c3f571b

Please sign in to comment.