static State Check(State state, ICluster cluster) { var now = DateTime.UtcNow.Ticks; foreach (var map in state.Scheduled) { foreach (var outerKeyValue in map) { foreach (var kv in outerKeyValue.Value) { if (kv.Value.Due < now) { var inboxKey = ActorInboxCommon.ClusterInboxKey(kv.Value.To, "user"); var inboxNotifyKey = ActorInboxCommon.ClusterInboxNotifyKey(kv.Value.To, "user"); if (cluster.Enqueue(inboxKey, kv.Value) > 0) { cluster.DeleteHashField(outerKeyValue.Key, kv.Key); state = state.Delete(outerKeyValue.Key, kv.Key); cluster.PublishToChannel(inboxNotifyKey, kv.Value.MessageId); } } } } } return(state); }
Unit TellNoIO(object message, ProcessId sender, string inbox, Message.Type type, Message.TagSpec tag) { ValidateMessageType(message, sender); var dto = RemoteMessageDTO.Create(message, ProcessId, sender, type, tag, SessionId, 0); var inboxKey = ActorInboxCommon.ClusterInboxKey(ProcessId, inbox); var inboxNotifyKey = ActorInboxCommon.ClusterInboxNotifyKey(ProcessId, inbox); Cluster.Enqueue(inboxKey, dto); var clientsReached = Cluster.PublishToChannel(inboxNotifyKey, dto.MessageId); return(unit); }