Short Circuit message to local connection in Redis (#1009)

This commit is contained in:
BrennanConroy 2017-10-11 13:17:49 -07:00 committed by GitHub
parent 8701baf73d
commit de34990241
1 changed files with 8 additions and 0 deletions

View File

@ -182,6 +182,14 @@ namespace Microsoft.AspNetCore.SignalR.Redis
var message = new InvocationMessage(GetInvocationId(), nonBlocking: true, target: methodName, arguments: args);
// If the connection is local we can skip sending the message through the bus since we require sticky connections.
// This also saves serializing and deserializing the message!
var connection = _connections[connectionId];
if (connection != null)
{
return WriteAsync(connection, message);
}
return PublishAsync(_channelNamePrefix + "." + connectionId, message);
}