Beispiel #1
0
        public static async Task Task2(IThrottler throttler)
        {
            Console.WriteLine("Async throttler...");
            var stopwatch = Stopwatch.StartNew();

            for (var i = 0; i < 350; i++)
            {
                // USe async mode
                await throttler.WaitForPermissionAsync();

                Console.WriteLine($"Async - {i}");
            }

            stopwatch.Stop();

            Console.WriteLine($"{stopwatch.Elapsed.TotalSeconds:##.00} s");
        }