Fix flaky ClientPingsMultipleTimes test (#2368)
This commit is contained in:
parent
6c927d093b
commit
02a9bde10d
|
|
@ -34,7 +34,6 @@ namespace Microsoft.AspNetCore.SignalR.Client
|
|||
public static readonly TimeSpan DefaultServerTimeout = TimeSpan.FromSeconds(30); // Server ping rate is 15 sec, this is 2 times that.
|
||||
public static readonly TimeSpan DefaultHandshakeTimeout = TimeSpan.FromSeconds(15);
|
||||
public static readonly TimeSpan DefaultPingInterval = TimeSpan.FromSeconds(15);
|
||||
public static readonly TimeSpan DefaultTickRate = TimeSpan.FromSeconds(1);
|
||||
|
||||
// This lock protects the connection state.
|
||||
private readonly SemaphoreSlim _connectionLock = new SemaphoreSlim(1, 1);
|
||||
|
|
@ -56,7 +55,7 @@ namespace Microsoft.AspNetCore.SignalR.Client
|
|||
public event Func<Exception, Task> Closed;
|
||||
|
||||
// internal for testing purposes
|
||||
internal TimeSpan TickRate { get; set; } = DefaultTickRate;
|
||||
internal TimeSpan TickRate { get; set; } = TimeSpan.FromSeconds(1);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the server timeout interval for the connection.
|
||||
|
|
|
|||
|
|
@ -580,10 +580,10 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
|
|||
{
|
||||
await hubConnection.StartAsync().OrTimeout();
|
||||
|
||||
var firstPing = await connection.ReadSentTextMessageAsync().OrTimeout(TimeSpan.FromMilliseconds(200));
|
||||
var firstPing = await connection.ReadSentTextMessageAsync().OrTimeout();
|
||||
Assert.Equal("{\"type\":6}", firstPing);
|
||||
|
||||
var secondPing = await connection.ReadSentTextMessageAsync().OrTimeout(TimeSpan.FromMilliseconds(200));
|
||||
var secondPing = await connection.ReadSentTextMessageAsync().OrTimeout();
|
||||
Assert.Equal("{\"type\":6}", secondPing);
|
||||
}
|
||||
finally
|
||||
|
|
|
|||
Loading…
Reference in New Issue