Esempio n. 1
0
            public QueueOperationDebouncer()
            {
                Register((QueueCommand q) => {
                    return(_currentCommands.TryAdd(q.Command.ID, Nothing.Value) ?
                           Next(q) :
                           Task.FromResult(QueueCommandResult.AlreadyProcessing()));
                });

                Register(async(ExecuteCommand e) => {
                    try {
                        await Next(e).Get();
                    } finally {
                        _currentCommands.TryRemove(e.Command.ID, out _);
                    }
                });
            }