Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchitmehta committed Dec 11, 2020
1 parent bb25b3e commit 6fd56de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Kudu.Core/Deployment/DeploymentStatusFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private DeploymentStatusFile(string id, IEnvironment environment, IOperationLock
{
throw new FileNotFoundException("Status file doesn't exist. Will wait for 1 second and retry");
}
}, 5, 250));
}, 3, 250));
}

public static DeploymentStatusFile Create(string id, IEnvironment environment, IOperationLock statusLock)
Expand Down Expand Up @@ -74,7 +74,7 @@ public static DeploymentStatusFile Open(string id, IEnvironment environment, IAn
{
// In case we read status file in middle of a write, attempt to
// read it again. Don't fail the status get request
XDocument document = OperationManager.Attempt(() => LoadXmlStatusFile(path), 5, 250);
XDocument document = OperationManager.Attempt(() => LoadXmlStatusFile(path), 3, 250);
return new DeploymentStatusFile(id, environment, statusLock, document);
}
catch (Exception ex)
Expand Down
9 changes: 5 additions & 4 deletions Kudu.Core/Infrastructure/WindowsLockFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,15 @@ public virtual bool IsHeld

public virtual bool Lock(string operationName)
{
_traceFactory.GetTracer().Trace($"Acquiring lock {_path}");
Stream lockStream = null;
try
{

FileSystemHelpers.EnsureDirectory(Path.GetDirectoryName(_path));
if (FileSystemHelpers.FileExists(_path))
{
return false;
}
lockStream = FileSystemHelpers.OpenFile(_path, FileMode.Create, FileAccess.Write, FileShare.ReadWrite);

WriteLockInfo(operationName, lockStream);
Expand All @@ -153,7 +156,6 @@ public virtual bool Lock(string operationName)

_lockStream = lockStream;
lockStream = null;
_traceFactory.GetTracer().Trace($"Lock Acquired {_path}");
return true;
}
catch (UnauthorizedAccessException)
Expand Down Expand Up @@ -260,7 +262,6 @@ public Task LockAsync(string operationName)

public virtual void Release()
{
_traceFactory.GetTracer().Trace($"Releasing lock {_path}");
// Normally, this should never be null here, but currently some LiveScmEditorController code calls Release() incorrectly
if (_lockStream == null)
{
Expand Down Expand Up @@ -292,7 +293,7 @@ private void DeleteFileSafe()
OperationManager.Attempt(() =>
// throws exception if file is still present
TryRemovedLockFile()
, 10, 250);
, 2, 250);
}
catch (Exception ex)
{
Expand Down

0 comments on commit 6fd56de

Please sign in to comment.