コード例 #1
0
        private void InitSecurityProxy()
        {
            _loginTimer = new Timer(
                async x =>
            {
                await securityProxy.LoginAsync(serverListManager.GetServerList());
            }, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(_securityInfoRefreshIntervalMills));

            // init should wait the result.
            securityProxy.LoginAsync(serverListManager.GetServerList()).Wait();
        }
コード例 #2
0
        public MsConfigServerHttpAgent(NacosOptions options)
        {
            _options       = options;
            _serverListMgr = new ServerListManager(_options);
            _namespaceId   = _options.Namespace;

            _serverListMgr = new ServerListManager(_options);
            _securityProxy = new SecurityProxy(_options, null);

            _securityProxy.LoginAsync(_serverListMgr.GetServerUrls()).ConfigureAwait(false).GetAwaiter().GetResult();

            _timer = new Timer(
                async x =>
            {
                await _securityProxy.LoginAsync(_serverListMgr.GetServerUrls()).ConfigureAwait(false);
            }, null, 0, _securityInfoRefreshIntervalMills);
        }