예제 #1
0
        public void Start()
        {
            // initial load
            LoadConfig().Wait();

            _taskScheduler.ScheduleOnInterval(async() =>
            {
                if (_isRequestingNow)
                {
                    return;
                }

                _isRequestingNow = true;

                try
                {
                    await LoadConfig();
                }
                finally
                {
                    _isRequestingNow = false;
                }

                _logger.Info($"Received {_serverList.Count()} server info records");
            }, _config.Value.ServerInfoListUpdateIntervalMs, _config.Value.ServerInfoListUpdateIntervalMs);
            _logger.Info($"RouterServerInfoProvider started");
        }
        private async Task GetList()
        {
            if (_isRequestingNow)
            {
                return;
            }

            _isRequestingNow = true;
            try
            {
                _serverList = await _routerClient.GetServerInfoList(false);

                _gameServerList = BuildGameServersList();
                _logger.Info($"MatchMakerServerInfoProvider.GetServerInfoListResponse: i have {_gameServerList.Count()} game servers");
            }
            finally
            {
                _isRequestingNow = false;
            }
        }