Skip to content

Plumb a clock interface through SignalR for testing #19311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 31, 2020
Merged

Conversation

BrennanConroy
Copy link
Member

  • Removed a couple constructors that were only used for tests
  • This makes the timing tests 100% reliable, and faster because no more Task.Delay(...)

Not very happy with the compile includes, but didn't want to do internals visible to, or design a new public type.

@BrennanConroy BrennanConroy added the area-signalr Includes: SignalR clients and servers label Feb 25, 2020
@BrennanConroy BrennanConroy added this to the 5.0.0-preview2 milestone Feb 25, 2020
{
_logger = loggerFactory.CreateLogger<HttpConnectionManager>();
_connectionLogger = loggerFactory.CreateLogger<HttpConnectionContext>();
_nextHeartbeat = new TimerAwaitable(_heartbeatTickRate, _heartbeatTickRate);
_disconnectTimeout = connectionOptions.Value.DisconnectTimeout ?? ConnectionOptionsSetup.DefaultDisconectTimeout;
if (AppContext.TryGetSwitch("Microsoft.AspNetCore.Http.Connections.DoNotUseSendTimeout", out var timeoutDisabled))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the switch?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was only for patch branches

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we do this in other places too. Like MVC


namespace Microsoft.AspNetCore.Internal
{
internal interface ISystemClock
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we share this stuff with Kestrel?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, I did just copy it from Kestrel.

@@ -223,8 +223,6 @@ private async Task DispatchMessagesAsync(HubConnectionContext connection)
var result = await input.ReadAsync();
var buffer = result.Buffer;

connection.ResetClientTimeout();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? This moved?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's no longer needed with how we changed timeouts

@BrennanConroy
Copy link
Member Author

Ok, fixed this to be scoped to just HubConnectionHandler and set it in tests that want to control the clock.

@BrennanConroy BrennanConroy merged commit 58db57b into master Mar 31, 2020
@BrennanConroy BrennanConroy deleted the brecon/clock branch March 31, 2020 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants