Пример #1
0
        private async Task OnStarting()
        {
            var startupService = Container.Resolve <StartupCheckingService>();
            var context        = Container.Resolve <CryptoGramBotDbContext>();

            await DbInitializer.Initialize(context);

            var limiterTotal       = new RateLimiterPerEndpoint(1, TimeSpan.FromSeconds(1));
            var limiterPerEndpoint = new RateLimiterPerEndpoint(1, TimeSpan.FromSeconds(1));

            BittrexDefaults.AddDefaultRateLimiter(limiterTotal);
            BittrexDefaults.AddDefaultRateLimiter(limiterPerEndpoint);

            startupService.Start();
        }
Пример #2
0
        private async Task OnStarting()
        {
            var startupService = Container.Resolve <StartupCheckingService>();
            var context        = Container.Resolve <CryptoGramBotDbContext>();

            await DbInitializer.Initialize(context);

            var limiterTotal       = new RateLimiterPerEndpoint(1, TimeSpan.FromSeconds(1));
            var limiterPerEndpoint = new RateLimiterPerEndpoint(1, TimeSpan.FromSeconds(1));

            BittrexClient.SetDefaultOptions(new BittrexClientOptions
            {
                RateLimiters = new List <IRateLimiter>
                {
                    limiterTotal,
                    limiterPerEndpoint
                }
            });

            startupService.Start();
        }