internal static LanguageExt.Unit removeSessionIdFromSuppMap(ICluster cluster, SessionId sessionId) { var supp = cluster.GetHashField <string>(sessionToSuppKey, sessionId.Value); cluster.DeleteHashField(sessionToSuppKey, sessionId.Value); supp.IfSome(s => cluster.DeleteHashField(suppToSessionKey, s)); return(unit); }
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); }
static State RemoveFromSchedule(State state, Msg.RemoveFromScheduleMsg msg, ICluster cluster) { cluster.DeleteHashField(msg.InboxKey, msg.Id); return(state.Delete(msg.InboxKey, msg.Id)); }