mirror of
https://github.com/actions/runner.git
synced 2025-12-12 15:13:30 +00:00
Retries to lock Services database on Windows (#2880)
This commit is contained in:
@@ -514,9 +514,25 @@ namespace GitHub.Runner.Listener.Configuration
|
|||||||
failureActions.Add(new FailureAction(RecoverAction.Restart, 60000));
|
failureActions.Add(new FailureAction(RecoverAction.Restart, 60000));
|
||||||
|
|
||||||
// Lock the Service Database
|
// Lock the Service Database
|
||||||
svcLock = LockServiceDatabase(scmHndl);
|
int svcLockRetries = 10;
|
||||||
if (svcLock.ToInt64() <= 0)
|
int svcLockRetryTimeout = 5000;
|
||||||
|
while (true)
|
||||||
{
|
{
|
||||||
|
svcLock = LockServiceDatabase(scmHndl);
|
||||||
|
if (svcLock.ToInt64() > 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_term.WriteLine("Retrying Lock Service Database...");
|
||||||
|
|
||||||
|
svcLockRetries--;
|
||||||
|
if (svcLockRetries > 0)
|
||||||
|
{
|
||||||
|
Thread.Sleep(svcLockRetryTimeout);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
throw new Exception("Failed to Lock Service Database for Write");
|
throw new Exception("Failed to Lock Service Database for Write");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user