Пример #1
0
        public async Task <BreakoutRoomInternalState?> Handle(ApplyBreakoutRoomRequest request,
                                                              CancellationToken cancellationToken)
        {
            var(conferenceId, newState, @lock, createNew) = request;

            BreakoutRoomInternalState?internalState;

            await using (@lock ?? await _repository.LockBreakoutRooms(request.ConferenceId))
            {
                internalState = await ApplyState(conferenceId, newState, createNew);
            }

            await _mediator.Send(new UpdateSynchronizedObjectRequest(conferenceId, SynchronizedBreakoutRooms.SyncObjId),
                                 cancellationToken);

            return(internalState);
        }
        public async Task Handle(BreakoutRoomTimerElapsedNotification notification, CancellationToken cancellationToken)
        {
            await using var @lock = await _repository.LockBreakoutRooms(notification.ConferenceId);

            var currentState = await _repository.Get(notification.ConferenceId);

            if (currentState == null)
            {
                return;
            }

            if (notification.TokenId != null && currentState.TimerTokenId != notification.TokenId)
            {
                return;
            }

            await _mediator.Send(new ApplyBreakoutRoomRequest(notification.ConferenceId, null, @lock),
                                 cancellationToken);
        }
Пример #3
0
        public async Task <SuccessOrError <Unit> > Handle(ChangeBreakoutRoomsRequest request,
                                                          CancellationToken cancellationToken)
        {
            var(conferenceId, patch) = request;
            await using (var @lock = await _repository.LockBreakoutRooms(conferenceId))
            {
                var current = await _repository.Get(conferenceId);

                if (current == null)
                {
                    return(BreakoutRoomError.NotOpen);
                }

                var newState = current.Config with {
                };                                      // clone
                patch.ApplyTo(newState);

                await _mediator.Send(new ApplyBreakoutRoomRequest(conferenceId, newState, @lock));
            }

            return(SuccessOrError <Unit> .Succeeded(Unit.Value));
        }