public async Task Process()
        {
            var arena = await _arenaLogic.GetArena();

            var bots = await _botLogic.GetAllLiveBots();

            var context = ProcessingContext.Build(arena, bots);

            await _preprocessor.Go(context);

            await _processor.Go(context);

            await _postprocessor.Go(context);

            await _botLogic.UpdateBots(context.Bots);
        }
        public async Task Process()
        {
            using (var stopwatch = new SimpleStopwatch())
            {
                var arena = await _arenaLogic.GetArena();

                var elapsedArena = stopwatch.ElapsedMilliseconds;

                var bots = await _botLogic.GetAllLiveBots();

                var elapsedBots = stopwatch.ElapsedMilliseconds - elapsedArena;

                var context = ProcessingContext.Build(arena, bots);

                await _preprocessor.Go(context);

                var elapsedPreprocessing = stopwatch.ElapsedMilliseconds - elapsedBots - elapsedArena;

                await _processor.Go(context);

                var elapsedProcessing = stopwatch.ElapsedMilliseconds - elapsedPreprocessing - elapsedBots - elapsedArena;

                await _postprocessor.Go(context);

                var elapsedPostprocessing = stopwatch.ElapsedMilliseconds - elapsedProcessing - elapsedPreprocessing - elapsedBots - elapsedArena;

                await _botLogic.UpdateBots(context.Bots);

                var elapsedUpdateBots = stopwatch.ElapsedMilliseconds - elapsedPostprocessing - elapsedProcessing - elapsedPreprocessing - elapsedBots - elapsedArena;

                //await _messageLogic.CreateMessages(context.Messages);
                var elapsedCreateMessages = stopwatch.ElapsedMilliseconds - elapsedUpdateBots - elapsedPostprocessing - elapsedProcessing - elapsedPreprocessing - elapsedBots - elapsedArena;

                Console.WriteLine(
                    $"{elapsedArena}ms, {elapsedBots}ms, {elapsedPreprocessing}ms, {elapsedProcessing}ms, {elapsedPostprocessing}ms, {elapsedUpdateBots}ms, {elapsedCreateMessages}ms");
            }
        }
Пример #3
0
    public async Task Process()
    {
        using var stopwatch = new SimpleStopwatch();

        var arena = await _arenaLogic.GetArena();

        var elapsedArena = stopwatch.ElapsedMilliseconds;

        var bots = await _botLogic.GetAllLiveBots();

        var elapsedBots = stopwatch.ElapsedMilliseconds - elapsedArena;

        var context = ProcessingContext.Build(arena, bots);

        await _preprocessor.Go(context);

        var elapsedPreprocessing = stopwatch.ElapsedMilliseconds - elapsedBots - elapsedArena;

        await _processor.Go(context);

        var elapsedProcessing = stopwatch.ElapsedMilliseconds - elapsedPreprocessing - elapsedBots - elapsedArena;

        await _postprocessor.Go(context);

        var elapsedPostprocessing = stopwatch.ElapsedMilliseconds - elapsedProcessing - elapsedPreprocessing - elapsedBots - elapsedArena;

        await _botLogic.UpdateBots(context.Bots);

        var elapsedUpdateBots = stopwatch.ElapsedMilliseconds - elapsedPostprocessing - elapsedProcessing - elapsedPreprocessing - elapsedBots - elapsedArena;

        //await _messageLogic.CreateMessages(context.Messages);
        var elapsedCreateMessages = stopwatch.ElapsedMilliseconds - elapsedUpdateBots - elapsedPostprocessing - elapsedProcessing - elapsedPreprocessing - elapsedBots - elapsedArena;

        _logger.LogInformation("{elapsedArena}ms, {elapsedBots}ms, {elapsedPreprocessing}ms, {elapsedProcessing}ms, {elapsedPostprocessing}ms, {elapsedUpdateBots}ms, {elapsedCreateMessages}ms",
                               elapsedArena, elapsedBots, elapsedPreprocessing, elapsedProcessing, elapsedPostprocessing, elapsedUpdateBots, elapsedCreateMessages);
    }