Ejemplo n.º 1
0
        private static async ValueTask <bool?> RemoveParticipantSafe(IKeyValueDatabaseActions database,
                                                                     string participantId, string connectionId)
        {
            var participantToConferenceKey  = GetParticipantToConferenceKey(participantId);
            var conferenceToParticipantsKey = GetConferenceToParticipantsKey("*");

            var result = await database.ExecuteScriptAsync(
                RedisScript.JoinedParticipantsRepository_RemoveParticipantSafe, participantId,
                participantToConferenceKey, conferenceToParticipantsKey, connectionId);

            if (result.IsNull)
            {
                return(null);
            }
            return((bool)result);
        }
Ejemplo n.º 2
0
        private static async ValueTask <PreviousParticipantState?> RemoveParticipant(IKeyValueDatabaseActions database,
                                                                                     string participantId)
        {
            var participantToConferenceKey  = GetParticipantToConferenceKey(participantId);
            var conferenceToParticipantsKey = GetConferenceToParticipantsKey("*");

            var result = await database.ExecuteScriptAsync(RedisScript.JoinedParticipantsRepository_RemoveParticipant,
                                                           participantId, participantToConferenceKey, conferenceToParticipantsKey);

            if (result.IsNull)
            {
                return(null);
            }

            var arr = (string[])result;

            return(new PreviousParticipantState(arr[0], arr[1]));
        }