Skip to content

Commit 0520001

Browse files
committed
Use TimeSpan instead of int for representing durations of time
1 parent ac01c21 commit 0520001

6 files changed

Lines changed: 85 additions & 84 deletions

File tree

src/corelib/Core/Domain/ServerBase.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,23 @@ protected virtual void UpdateThis(ServerBase server)
2727
/// Waits for the server to enter the ACTIVE state
2828
/// </summary>
2929
/// <param name="refreshCount">Number of times to check the images status</param>
30-
/// <param name="refreshDelayInMS">The number of milliseconds to wait each time before requesting the status for the image.</param>
30+
/// <param name="refreshDelay">The time to wait each time before requesting the status for the image. If this value is <c>null</c>, the default is 2.4 seconds.</param>
3131
/// <param name="progressUpdatedCallback">A callback delegate to execute each time the <see cref="SimpleServer"/>s Progress value increases.</param>
32-
public void WaitForActive(int refreshCount = 600, int refreshDelayInMS = 2400, Action<int> progressUpdatedCallback = null)
32+
public void WaitForActive(int refreshCount = 600, TimeSpan? refreshDelay = null, Action<int> progressUpdatedCallback = null)
3333
{
34-
var details = Provider.WaitForServerActive(Id, refreshCount, refreshDelayInMS, progressUpdatedCallback, Region);
34+
var details = Provider.WaitForServerActive(Id, refreshCount, refreshDelay ?? TimeSpan.FromMilliseconds(2400), progressUpdatedCallback, Region);
3535
UpdateThis(details);
3636
}
3737

3838
/// <summary>
3939
/// Waits for the server to enter the DELETED state
4040
/// </summary>
4141
/// <param name="refreshCount">Number of times to check the server status</param>
42-
/// <param name="refreshDelayInMS">The number of milliseconds to wait each time before requesting the status for the server.</param>
42+
/// <param name="refreshDelay">The time to wait each time before requesting the status for the server. If this value is <c>null</c>, the default is 2.4 seconds.</param>
4343
/// <param name="progressUpdatedCallback">A callback delegate to execute each time the <see cref="SimpleServer"/>s Progress value increases.</param>
44-
public void WaitForDeleted(int refreshCount = 600, int refreshDelayInMS = 2400, Action<int> progressUpdatedCallback = null)
44+
public void WaitForDeleted(int refreshCount = 600, TimeSpan? refreshDelay = null, Action<int> progressUpdatedCallback = null)
4545
{
46-
Provider.WaitForServerDeleted(Id, refreshCount, refreshDelayInMS, progressUpdatedCallback, Region);
46+
Provider.WaitForServerDeleted(Id, refreshCount, refreshDelay ?? TimeSpan.FromMilliseconds(2400), progressUpdatedCallback, Region);
4747
}
4848

4949
/// <summary>
@@ -52,11 +52,11 @@ public void WaitForDeleted(int refreshCount = 600, int refreshDelayInMS = 2400,
5252
/// <param name="expectedState">The expected <see cref="ServerState"/></param>
5353
/// <param name="errorStates">A list of <see cref="ServerState"/>s in which to throw an exception if the server enters. </param>
5454
/// <param name="refreshCount">Number of times to check the server status</param>
55-
/// <param name="refreshDelayInMS">The number of milliseconds to wait each time before requesting the status for the server.</param>
55+
/// <param name="refreshDelay">The time to wait each time before requesting the status for the server. If this value is <c>null</c>, the default is 2.4 seconds.</param>
5656
/// <param name="progressUpdatedCallback">A callback delegate to execute each time the <see cref="SimpleServer"/>s Progress value increases.</param>
57-
public void WaitForState(string expectedState, string[] errorStates, int refreshCount = 600, int refreshDelayInMS = 2400, Action<int> progressUpdatedCallback = null)
57+
public void WaitForState(string expectedState, string[] errorStates, int refreshCount = 600, TimeSpan? refreshDelay = null, Action<int> progressUpdatedCallback = null)
5858
{
59-
var details = Provider.WaitForServerState(Id, expectedState, errorStates, refreshCount, refreshDelayInMS, progressUpdatedCallback, Region);
59+
var details = Provider.WaitForServerState(Id, expectedState, errorStates, refreshCount, refreshDelay ?? TimeSpan.FromMilliseconds(2400), progressUpdatedCallback, Region);
6060
UpdateThis(details);
6161
}
6262

@@ -66,11 +66,11 @@ public void WaitForState(string expectedState, string[] errorStates, int refresh
6666
/// <param name="expectedStates">The set expected <see cref="ServerState"/>s</param>
6767
/// <param name="errorStates">A list of <see cref="ServerState"/>s in which to throw an exception if the server enters. </param>
6868
/// <param name="refreshCount">Number of times to check the server status</param>
69-
/// <param name="refreshDelayInMS">The number of milliseconds to wait each time before requesting the status for the server.</param>
69+
/// <param name="refreshDelay">The time to wait each time before requesting the status for the server. If this value is <c>null</c>, the default is 2.4 seconds.</param>
7070
/// <param name="progressUpdatedCallback">A callback delegate to execute each time the <see cref="SimpleServer"/>s Progress value increases.</param>
71-
public void WaitForState(string[] expectedStates, string[] errorStates, int refreshCount = 600, int refreshDelayInMS = 2400, Action<int> progressUpdatedCallback = null)
71+
public void WaitForState(string[] expectedStates, string[] errorStates, int refreshCount = 600, TimeSpan? refreshDelay = null, Action<int> progressUpdatedCallback = null)
7272
{
73-
var details = Provider.WaitForServerState(Id, expectedStates, errorStates, refreshCount, refreshDelayInMS, progressUpdatedCallback, Region);
73+
var details = Provider.WaitForServerState(Id, expectedStates, errorStates, refreshCount, refreshDelay ?? TimeSpan.FromMilliseconds(2400), progressUpdatedCallback, Region);
7474
UpdateThis(details);
7575
}
7676

src/corelib/Core/Domain/SimpleServerImage.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@ public class SimpleServerImage : ProviderStateBase<IComputeProvider>
2121
/// Waits for the image to enter the ACTIVE state
2222
/// </summary>
2323
/// <param name="refreshCount">Number of times to check the images status</param>
24-
/// <param name="refreshDelayInMS">The number of milliseconds to wait each time before requesting the status for the image.</param>
24+
/// <param name="refreshDelay">The time to wait each time before requesting the status for the image. If this value is <c>null</c>, the default is 2.4 seconds.</param>
2525
/// <param name="progressUpdatedCallback">A callback delegate to execute each time the <see cref="SimpleServer"/>s Progress value increases.</param>
26-
public void WaitForActive(int refreshCount = 600, int refreshDelayInMS = 2400, Action<int> progressUpdatedCallback = null)
26+
public void WaitForActive(int refreshCount = 600, TimeSpan? refreshDelay = null, Action<int> progressUpdatedCallback = null)
2727
{
28-
var details = Provider.WaitForImageActive(Id, refreshCount, refreshDelayInMS, progressUpdatedCallback, Region);
28+
var details = Provider.WaitForImageActive(Id, refreshCount, refreshDelay, progressUpdatedCallback, Region);
2929
UpdateThis(details);
3030
}
3131

3232
/// <summary>
3333
/// Waits for the image to enter the DELETED state
3434
/// </summary>
3535
/// <param name="refreshCount">Number of times to check the images status</param>
36-
/// <param name="refreshDelayInMS">The number of milliseconds to wait each time before requesting the status for the image.</param>
36+
/// <param name="refreshDelay">The time to wait each time before requesting the status for the image. If this value is <c>null</c>, the default is 2.4 seconds.</param>
3737
/// <param name="progressUpdatedCallback">A callback delegate to execute each time the <see cref="SimpleServer"/>s Progress value increases.</param>
38-
public void WaitForDelete(int refreshCount = 600, int refreshDelayInMS = 2400, Action<int> progressUpdatedCallback = null)
38+
public void WaitForDelete(int refreshCount = 600, TimeSpan? refreshDelay = null, Action<int> progressUpdatedCallback = null)
3939
{
40-
Provider.WaitForImageDeleted(Id, refreshCount, refreshDelayInMS, progressUpdatedCallback, Region);
40+
Provider.WaitForImageDeleted(Id, refreshCount, refreshDelay, progressUpdatedCallback, Region);
4141
}
4242

4343

@@ -47,11 +47,11 @@ public void WaitForDelete(int refreshCount = 600, int refreshDelayInMS = 2400, A
4747
/// <param name="expectedState">The expected <see cref="ImageState"/></param>
4848
/// <param name="errorStates">A list of <see cref="ImageState"/>s in which to throw an exception if the server enters. </param>
4949
/// <param name="refreshCount">Number of times to check the images status</param>
50-
/// <param name="refreshDelayInMS">The number of milliseconds to wait each time before requesting the status for the image.</param>
50+
/// <param name="refreshDelay">The time to wait each time before requesting the status for the image. If this value is <c>null</c>, the default is 2.4 seconds.</param>
5151
/// <param name="progressUpdatedCallback">A callback delegate to execute each time the <see cref="SimpleServer"/>s Progress value increases.</param>
52-
public void WaitForState(string expectedState, string[] errorStates, int refreshCount = 600, int refreshDelayInMS = 2400, Action<int> progressUpdatedCallback = null)
52+
public void WaitForState(string expectedState, string[] errorStates, int refreshCount = 600, TimeSpan? refreshDelay = null, Action<int> progressUpdatedCallback = null)
5353
{
54-
var details = Provider.WaitForImageState(Id, expectedState, errorStates, refreshCount, refreshDelayInMS, progressUpdatedCallback, Region);
54+
var details = Provider.WaitForImageState(Id, expectedState, errorStates, refreshCount, refreshDelay, progressUpdatedCallback, Region);
5555
UpdateThis(details);
5656
}
5757

@@ -61,11 +61,11 @@ public void WaitForState(string expectedState, string[] errorStates, int refresh
6161
/// <param name="expectedStates">The set expected <see cref="ImageState"/>s</param>
6262
/// <param name="errorStates">A list of <see cref="ImageState"/>s in which to throw an exception if the server enters. </param>
6363
/// <param name="refreshCount">Number of times to check the images status</param>
64-
/// <param name="refreshDelayInMS">The number of milliseconds to wait each time before requesting the status for the image.</param>
64+
/// <param name="refreshDelay">The time to wait each time before requesting the status for the image. If this value is <c>null</c>, the default is 2.4 seconds.</param>
6565
/// <param name="progressUpdatedCallback">A callback delegate to execute each time the <see cref="SimpleServer"/>s Progress value increases.</param>
66-
public void WaitForState(string[] expectedStates, string[] errorStates, int refreshCount = 600, int refreshDelayInMS = 2400, Action<int> progressUpdatedCallback = null)
66+
public void WaitForState(string[] expectedStates, string[] errorStates, int refreshCount = 600, TimeSpan? refreshDelay = null, Action<int> progressUpdatedCallback = null)
6767
{
68-
var details = Provider.WaitForImageState(Id, expectedStates, errorStates, refreshCount, refreshDelayInMS, progressUpdatedCallback, Region);
68+
var details = Provider.WaitForImageState(Id, expectedStates, errorStates, refreshCount, refreshDelay, progressUpdatedCallback, Region);
6969
UpdateThis(details);
7070
}
7171

0 commit comments

Comments
 (0)