public async Task<IRedisResponse> SendAsync(IClusterCommand command, MasterSlavePreference masterSlavePreference) { var slot = command.GetSlot(); var movedKeyRetriesLeft = _configuration.MaximumMovedKeyRetries; while (movedKeyRetriesLeft > 0) { var nodeForThisSlot = _nodes.GetBySlot(slot); if (nodeForThisSlot == null) { //TODO: Reload cluster/slot info throw ExceptionBecause.Cluster.CouldNotFindSlotOwner(slot); } var result = await nodeForThisSlot.SendAsync(command, masterSlavePreference); if (result.Value.IsError) { var movedResponse = MovedResponse.From(result); if (movedResponse != null) { await _nodes.UpdateSlotOwnership(movedResponse); movedKeyRetriesLeft--; continue; } } return result; } throw ExceptionBecause.Cluster.RetriedMovedKeyUntilLimitReached(slot, movedKeyRetriesLeft); }
/// <summary> /// Event arguments for cluster message acknowledgement events. /// </summary> /// <param name="Command">Command object.</param> /// <param name="Responses">Message acknowledgement responses</param> /// <param name="State">State object passed on to the original request.</param> public ClusterResponseEventArgs(IClusterCommand Command, EndpointResponse <ResponseType>[] Responses, object State) : base() { this.command = Command; this.responses = Responses; this.state = State; }
public async Task<IRedisResponse> SendAsync(IClusterCommand clusterCommand, MasterSlavePreference masterSlavePreference) { return await _node.SendAsync(clusterCommand.ToCommand(), masterSlavePreference); }