Skip to content

Commit

Permalink
[ReceveryServices] Fix delay in long running operations (#18568)
Browse files Browse the repository at this point in the history
* fix delay

* update changelog
  • Loading branch information
VeryEarly authored Jun 17, 2022
1 parent d8ab059 commit ee57d06
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ public static T GetOperationStatus<T>(RestAzureNS.AzureOperationResponse respons
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Body.Status == ServiceClientModel.OperationStatusValues.InProgress)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || !TestMockSupport.RunningMocked)
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
{
Thread.Sleep(5000);
Thread.Sleep(10000);
}
else
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
opStatusResponse = getOpStatus(operationId);
}
Expand Down Expand Up @@ -79,10 +82,13 @@ public static T GetOperationStatus<T, S>(RestAzureNS.AzureOperationResponse<S> r
while (opStatusResponse.Body.Status ==
ServiceClientModel.OperationStatusValues.InProgress)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || !TestMockSupport.RunningMocked)
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
{
Thread.Sleep(10000);
}
else
{
Thread.Sleep(5000);
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
opStatusResponse = getOpStatus(operationId);
}
Expand Down Expand Up @@ -110,10 +116,13 @@ public static RestAzureNS.AzureOperationResponse GetOperationResult(
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Response.StatusCode == SystemNet.HttpStatusCode.Accepted)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || !TestMockSupport.RunningMocked)
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
{
Thread.Sleep(10000);
}
else
{
Thread.Sleep(5000);
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
opStatusResponse = getOpStatus(operationId);
}
Expand Down Expand Up @@ -141,10 +150,13 @@ public static RestAzureNS.AzureOperationResponse<T> GetOperationStatusDataMove<T
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Body.Status == "InProgress")
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || !TestMockSupport.RunningMocked)
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
{
Thread.Sleep(5000);
Thread.Sleep(10000);
}
else
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
opStatusResponse = getOpStatus(operationId);
}
Expand All @@ -171,10 +183,13 @@ public static RestAzureNS.AzureOperationResponse<T> GetOperationResult<T>(
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Response.StatusCode == SystemNet.HttpStatusCode.Accepted)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || !TestMockSupport.RunningMocked)
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
{
Thread.Sleep(10000);
}
else
{
Thread.Sleep(5000);
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
opStatusResponse = getOpStatus(operationId);
}
Expand Down Expand Up @@ -216,10 +231,13 @@ public static RestAzureNS.AzureOperationResponse<T> GetOperationResult<T>(
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
while (opStatusResponse.Response.StatusCode == SystemNet.HttpStatusCode.Accepted)
{
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0 || !TestMockSupport.RunningMocked)
if (String.Compare(testMode, "Record", StringComparison.OrdinalIgnoreCase) == 0)
{
Thread.Sleep(10000);
}
else
{
Thread.Sleep(5000);
TestMockSupport.Delay(_defaultSleepForOperationTracking * 1000);
}
opStatusResponse = getOpStatus(operationId);
}
Expand Down
1 change: 1 addition & 0 deletions src/RecoveryServices/RecoveryServices/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Fixed delay in long running operations [#18567]

## Version 5.4.0
* Added support for Multi-user authorization using Resource Guard for recovery services vault.
Expand Down

0 comments on commit ee57d06

Please sign in to comment.