-
Notifications
You must be signed in to change notification settings - Fork 103
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
add configurable timeout #1103
add configurable timeout #1103
Conversation
@@ -15,9 +15,9 @@ namespace Microsoft.Azure.SignalR | |||
{ | |||
internal class ServiceRouteHelper | |||
{ | |||
public static async Task RedirectToService(HttpContext context, string hubName, IList<IAuthorizeData> authorizationData) | |||
public static async Task RedirectToService(HttpContext context, Type hubType, IList<IAuthorizeData> authorizationData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RedirectToService<T>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
namespace Microsoft.Azure.SignalR | ||
{ | ||
internal interface INegotiateHandler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need if not used in DI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (handshakeTimeout.Value.CompareTo(TimeSpan.Zero) <= 0 || | ||
handshakeTimeout.Value.CompareTo(Constants.Periods.MaxCustomHandshakeTimeout) > 0) | ||
{ | ||
Log.FailToSetCustomHandshakeTimeout(logger, new ArgumentOutOfRangeException(nameof(handshakeTimeout))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move the check to some validation when startup? otherwise customer gets such log for every request
@@ -66,7 +66,7 @@ private Endpoint CreateNegotiateEndpoint(RouteEndpoint routeEndpoint) | |||
// Replaces the negotiate endpoint with one that does the service redirect | |||
var routeEndpointBuilder = new RouteEndpointBuilder(async context => | |||
{ | |||
await ServiceRouteHelper.RedirectToService(context, hubMetadata.HubType.Name, null); | |||
await ServiceRouteHelper.RedirectToService(context, hubMetadata.HubType, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make CreateNegotiateEndpoint
a generic method then? It only runs when start, while your approach creates the type for every request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CreateNegotiateEndpoint
is used here, there's still no way to get the <THub>
here.
The ApplyAsync
is invoked on each negotiate request, while CreateNegotiateEndpoint
needs the CandidateSet
as a input parameter.
How about I change the ServiceRouteHelper
to ServiceRouteHelper<Thub>
, and DI to the gloabl service collection, and then get the service here and call the ServiceRouteHelper<THub>.RedirectToService()
method? Then I don't need INegotiateHandler
and Type
of the hub any more.
042f46b
to
0b3e8d6
Compare
{ | ||
return type => | ||
{ | ||
var methodInfo = typeof(NegotiateMatcherPolicy).GetMethod(nameof(CreateNegotiateEndpointCore), BindingFlags.NonPublic | BindingFlags.Instance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move it to outside of lamda, otherwise it is evaluated everytime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be static
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vicancy updated
private Endpoint CreateNegotiateEndpoint(RouteEndpoint routeEndpoint) | ||
private Func<Type, Endpoint> CreateNegotiateEndpoint(Type hubType, RouteEndpoint routeEndpoint) | ||
{ | ||
var methodInfo = typeof(NegotiateMatcherPolicy).GetMethod(nameof(CreateNegotiateEndpointCore), BindingFlags.NonPublic | BindingFlags.Static); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be static readonly
eb6a389
to
a06216d
Compare
Summary of the changes (Less than 80 chars)
Fixes #bugnumber (in this specific format)