attempt to fix intermittent failures
This commit is contained in:
parent
05e60505b0
commit
1f07e1e2e3
1 changed files with 8 additions and 8 deletions
|
@ -20,18 +20,18 @@ namespace Microsoft.DotNet.Cli.Utils
|
|||
|
||||
public static async Task<LockFile> ReadWithLock(this LockFileFormat subject, string path)
|
||||
{
|
||||
if(!File.Exists(path))
|
||||
{
|
||||
throw new GracefulException(string.Join(
|
||||
Environment.NewLine,
|
||||
string.Format(LocalizableStrings.FileNotFound, path),
|
||||
LocalizableStrings.ProjectNotRestoredOrRestoreFailed));
|
||||
}
|
||||
|
||||
return await ConcurrencyUtilities.ExecuteWithFileLockedAsync(
|
||||
path,
|
||||
lockedToken =>
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
throw new GracefulException(string.Join(
|
||||
Environment.NewLine,
|
||||
string.Format(LocalizableStrings.FileNotFound, path),
|
||||
LocalizableStrings.ProjectNotRestoredOrRestoreFailed));
|
||||
}
|
||||
|
||||
var lockFile = FileAccessRetrier.RetryOnFileAccessFailure(() => subject.Read(path));
|
||||
|
||||
return lockFile;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue