Fix flaky ClientPingsMultipleTimes test (#2368)

This commit is contained in:
James Newton-King 2018-05-24 17:29:15 +12:00 committed by GitHub
parent 6c927d093b
commit 02a9bde10d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -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.

View File

@ -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