コード例 #1
0
        public async Task <HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default(CancellationToken))
        {
            try
            {
                var stopwatch = new Stopwatch();
                stopwatch.Start();
                var dictionaries = await _wargamingApiClient.GetStaticDictionariesAsync();

                stopwatch.Stop();
                return(HealthCheckResult.Healthy($"Got dictionaries from Wargaming for {stopwatch.ElapsedMilliseconds} ms"));
            }
            catch (Exception e)
            {
                return(HealthCheckResult.Unhealthy($"Could not read dictionaries from Wargaming: '{e.Message}'"));
            }
        }
コード例 #2
0
        public async Task <IActionResult> SaveDictionaries()
        {
            (var languages,
             var nations,
             var vehicleTypes,
             var achievementSections,
             var clanRoles) = await _wgApi.GetStaticDictionariesAsync();

            await _blitzStatisticsDictionary.SaveDictionaries(
                languages,
                nations,
                vehicleTypes,
                achievementSections,
                clanRoles);

            return(Ok());
        }
コード例 #3
0
        private async Task LoadDictionaries()
        {
            if (_wargamingDictionaries.AreDictionariesCashed)
            {
                return;
            }
            var(languages, nations, vehicleTypes, achievemntSection, clanRoles) = await _wargamingApiClient.GetStaticDictionariesAsync().ConfigureAwait(false);

            var achievementsDictionary = await _wargamingApiClient.GetAchievementsDictionaryAsync().ConfigureAwait(false);

            var vehicles = await _wargamingApiClient.GetWotEncyclopediaVehiclesAsync().ConfigureAwait(false);

            _wargamingDictionaries.SaveToCache(
                nations,
                vehicleTypes,
                achievementsDictionary,
                vehicles);
        }