From 124d8634deadc7556ec8205511a762c51f9b40cd Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Wed, 3 Nov 2021 11:21:13 +0100 Subject: [PATCH] Try to delete the workspace instead of fail (#3589) * Try to delete the workspace instead of fail Creation of the new workspace will fail anyway it it still exists. But 2 agents may delete the same workspace at the ecact same time. Fixes: #3588 * Remove newline Co-authored-by: Alexander Smolyakov --- src/Agent.Plugins/TfsVCSourceProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Agent.Plugins/TfsVCSourceProvider.cs b/src/Agent.Plugins/TfsVCSourceProvider.cs index 64420ab33a..97a0cee6b6 100644 --- a/src/Agent.Plugins/TfsVCSourceProvider.cs +++ b/src/Agent.Plugins/TfsVCSourceProvider.cs @@ -253,7 +253,7 @@ await RemoveConflictingWorkspacesAsync( tfWorkspaces = await tf.WorkspacesAsync(matchWorkspaceNameOnAnyComputer: true); foreach (ITfsVCWorkspace tfWorkspace in tfWorkspaces ?? new ITfsVCWorkspace[0]) { - await tf.WorkspaceDeleteAsync(tfWorkspace); + await tf.TryWorkspaceDeleteAsync(tfWorkspace); } // Recreate the sources directory.