public async Task RunAsync()
        {
            Console.WriteLine("Stats processor starting up");
            await samplesChannel.ReceiveAllAsync(sample =>
            {
                stats.AddSample(sample);
            });

            Console.WriteLine("Stats processor shutting down, channel was closed");
        }
예제 #2
0
        public async Task RunAsync()
        {
            Console.WriteLine("Hit counter starting up");
            await hitChannel.ReceiveAllAsync(hit =>
            {
                Interlocked.Increment(ref totalTries);
                if (hit)
                {
                    Interlocked.Increment(ref totalHits);
                }
            });

            Console.WriteLine("Hit counter shutting down, channel closed");
        }
        public async Task RunAsync()
        {
            Console.WriteLine("Request processor starting up");
            await requestChannel.ReceiveAllAsync(async token =>
            {
                Stopwatch s = new Stopwatch();
                s.Start();

                await parser.ParseAsync(token);

                s.Stop();
                statsChannel.Publish(s.ElapsedMilliseconds);
            });

            Console.WriteLine("Request processor shutting down, channel is closed");
        }