Ejemplo n.º 1
0
        private async Task <IReadOnlyList <RenderingEnvironment> > Environments()
        {
            var envs = await Task.WhenAll((await _environmentCoordinator.ListEnvironments())
                                          .Select(env => _environmentCoordinator.GetEnvironment(env)));

            return(envs.Where(re => re != null).OrderBy(re => re.Name).ToList());
        }
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            var interval = TimeSpan.FromSeconds(60);

            while (!stoppingToken.IsCancellationRequested)
            {
                try
                {
                    var environments = await _environments.ListEnvironments();

                    await Task.WhenAll(environments.Select(async e => await AutoScaleEnvironment(await _environments.GetEnvironment(e))));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                await Task.Delay(interval, stoppingToken);
            }
        }
Ejemplo n.º 3
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            var interval = TimeSpan.FromSeconds(60);

            while (!stoppingToken.IsCancellationRequested)
            {
                try
                {
                    var environments = await _environments.ListEnvironments();

                    await Task.WhenAll(environments.Select(async e => await AutoScaleEnvironment(await _environments.GetEnvironment(e))));
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex, $"Unexpected error in {nameof(AutoScaleHost)} main loop");
                }

                await Task.Delay(interval, stoppingToken);
            }
        }