Exemple #1
0
        public async Task <CommandHandlingResult> Handle(UpdateLimitOrdersCountCommand command, IEventPublisher eventPublisher)
        {
            var sw = new Stopwatch();

            sw.Start();

            try
            {
                var activeLimitOrdersCount = await _limitOrdersRepository.GetActiveOrdersCountAsync(command.ClientId);

                await _clientCacheRepository.UpdateLimitOrdersCount(command.ClientId, activeLimitOrdersCount);

                ChaosKitty.Meow();

                _log.Info(nameof(UpdateLimitOrdersCountCommand), $"Client {command.ClientId}. Limit orders cache updated: {activeLimitOrdersCount} active orders");

                return(CommandHandlingResult.Ok());
            }
            finally
            {
                sw.Stop();
                _log.Info("Command execution time",
                          context: new { TxHandler = new { Handler = nameof(HistoryCommandHandler), Command = nameof(UpdateLimitOrdersCountCommand),
                                                           Time    = sw.ElapsedMilliseconds } });
            }
        }
        public async Task <CommandHandlingResult> Handle(UpdateLimitOrdersCountCommand command, IEventPublisher eventPublisher)
        {
            var activeLimitOrdersCount = await _limitOrdersRepository.GetActiveOrdersCountAsync(command.ClientId);

            await _clientCacheRepository.UpdateLimitOrdersCount(command.ClientId, activeLimitOrdersCount);

            ChaosKitty.Meow();

            _log.Info(nameof(UpdateLimitOrdersCountCommand), $"Client {command.ClientId}. Limit orders cache updated: {activeLimitOrdersCount} active orders");

            return(CommandHandlingResult.Ok());
        }