public void Start() { this.networkCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(new[] { serverLifetime.ApplicationStopping }); this.networkMonitorLoop = asyncLoopFactory.Run("NetworkManager.NetworkWorker", async token => { try { await UpdateNetworkHealth(networkCancellationTokenSource.Token).ConfigureAwait(false); } catch (Exception ex) { this.logger.LogError("Exception: {0}", ex); this.logger.LogTrace("(-)[UNHANDLED_EXCEPTION]"); throw; } }, this.networkCancellationTokenSource.Token, repeatEvery: TimeSpan.FromMilliseconds(this.monitorSleep), startAfter: TimeSpans.Second); }
private void ProfileServices() { this.networkCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(new[] { serverLifetime.ApplicationStopping }); asyncLoopFactory.Run("Price.ProfileCheckService", async token => { try { if (xServer.Stats.TierLevel == Tier.TierLevel.Two && networkFeatures.IsServerReady()) { await CheckReservedProfiles(this.networkCancellationTokenSource.Token).ConfigureAwait(false); } } catch (Exception ex) { this.logger.LogError("Exception: {0}", ex); this.logger.LogTrace("(-)[UNHANDLED_EXCEPTION_PROFILE_CHECK]"); throw; } }, this.networkCancellationTokenSource.Token, repeatEvery: TimeSpan.FromSeconds(this.updateProfileReservationsSeconds), startAfter: TimeSpans.TenSeconds); asyncLoopFactory.Run("Price.ProfileRelayService", async token => { try { if (xServer.Stats.TierLevel == Tier.TierLevel.Two && networkFeatures.IsServerReady()) { await RelayProfiles(this.networkCancellationTokenSource.Token).ConfigureAwait(false); } } catch (Exception ex) { this.logger.LogError("Exception: {0}", ex); this.logger.LogTrace("(-)[UNHANDLED_EXCEPTION_PROFILE_RELAY]"); throw; } }, this.networkCancellationTokenSource.Token, repeatEvery: TimeSpan.FromSeconds(this.relayProfileSeconds), startAfter: TimeSpans.TenSeconds); asyncLoopFactory.Run("Price.ProfileSyncService", async token => { try { if (networkFeatures.IsServerReady()) { await SyncProfiles(this.networkCancellationTokenSource.Token).ConfigureAwait(false); } } catch (Exception ex) { this.logger.LogError("Exception: {0}", ex); this.logger.LogTrace("(-)[UNHANDLED_EXCEPTION_PROFILE_SYNC]"); throw; } }, this.networkCancellationTokenSource.Token, repeatEvery: TimeSpan.FromSeconds(this.syncProfileSeconds), startAfter: TimeSpans.TenSeconds); }
private void PriceLockServices() { this.networkCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(new[] { serverLifetime.ApplicationStopping }); asyncLoopFactory.Run("Price.MyMonitor", async token => { try { if (xServer.Stats.TierLevel == Tier.TierLevel.Three) { await UpdateMyPriceList(this.networkCancellationTokenSource.Token).ConfigureAwait(false); } } catch (Exception ex) { this.logger.LogError("Exception: {0}", ex); this.logger.LogTrace("(-)[UNHANDLED_EXCEPTION_MY_PRICE]"); throw; } }, this.networkCancellationTokenSource.Token, repeatEvery: TimeSpan.FromSeconds(this.updateMyPriceSeconds), startAfter: TimeSpans.TenSeconds); asyncLoopFactory.Run("Price.NetworkMonitor", async token => { try { if (xServer.Stats.TierLevel == Tier.TierLevel.Three) { await UpdateNetworkPriceList(this.networkCancellationTokenSource.Token).ConfigureAwait(false); } } catch (Exception ex) { this.logger.LogError("Exception: {0}", ex); this.logger.LogTrace("(-)[UNHANDLED_EXCEPTION_NETWORK_PRICE]"); throw; } }, this.networkCancellationTokenSource.Token, repeatEvery: TimeSpan.FromSeconds(this.updateNetworkPriceSeconds), startAfter: TimeSpans.TenSeconds); asyncLoopFactory.Run("Price.PriceLockMonitor", async token => { try { if (xServer.Stats.TierLevel == Tier.TierLevel.Three && networkFeatures.IsServerReady()) { await PriceLockChecks(this.networkCancellationTokenSource.Token).ConfigureAwait(false); } } catch (Exception ex) { this.logger.LogError("Exception: {0}", ex); this.logger.LogTrace("(-)[UNHANDLED_EXCEPTION_NETWORK_PRICE]"); throw; } }, this.networkCancellationTokenSource.Token, repeatEvery: TimeSpans.Minute, startAfter: TimeSpans.TenSeconds); }
public void Start() { this.networkCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(new[] { serverLifetime.ApplicationStopping }); Startup().ConfigureAwait(false); asyncLoopFactory.Run("NetworkManager.NetworkWorker", async token => { try { if (networkFeatures.IsServerReady()) { await UpdateNetworkHealth().ConfigureAwait(false); } } catch (Exception ex) { this.logger.LogError("Exception: {0}", ex); this.logger.LogTrace("(-)[UNHANDLED_EXCEPTION_NETHEALTH]"); throw; } }, this.networkCancellationTokenSource.Token, repeatEvery: TimeSpan.FromSeconds(this.heckCheckSleepSeconds), startAfter: TimeSpans.Second); asyncLoopFactory.Run("NetworkManager.NewxServer", async token => { try { await RelayNewxServerAsync(this.networkCancellationTokenSource.Token).ConfigureAwait(false); } catch (Exception ex) { this.logger.LogError("Exception: {0}", ex); this.logger.LogTrace("(-)[UNHANDLED_EXCEPTION_XS_RELAY]"); throw; } }, this.networkCancellationTokenSource.Token, repeatEvery: TimeSpan.FromSeconds(this.relaySleepSeconds), startAfter: TimeSpans.Second); asyncLoopFactory.Run("NetworkManager.xServerReconciliation", async token => { try { if (networkFeatures.IsServerReady()) { await ReconcilexServersAsync(this.networkCancellationTokenSource.Token).ConfigureAwait(false); } } catch (Exception ex) { this.logger.LogError("Exception: {0}", ex); this.logger.LogTrace("(-)[UNHANDLED_EXCEPTION_RECO]"); throw; } }, this.networkCancellationTokenSource.Token, repeatEvery: TimeSpan.FromSeconds(this.serverRecoSleepSeconds), startAfter: TimeSpans.TenSeconds); asyncLoopFactory.Run("NetworkManager.NewPriceLock", async token => { try { await RelayNewPayLocks(this.networkCancellationTokenSource.Token).ConfigureAwait(false); } catch (Exception ex) { this.logger.LogError("Exception: {0}", ex); this.logger.LogTrace("(-)[UNHANDLED_EXCEPTION_PL_RELAY]"); throw; } }, this.networkCancellationTokenSource.Token, repeatEvery: TimeSpan.FromSeconds(this.relaySleepSeconds), startAfter: TimeSpans.Second); }