public async Task GetVersionUpdatesInfo() { var shouldRefresh = GetBoolValueQueryString("refresh", required: false) ?? false; if (shouldRefresh && IsLatestVersionCheckThrottled() == false) { await LatestVersionCheck.PerformAsync(); _lastRunAt = SystemTime.UtcNow; } WriteVersionUpdatesInfo(); }
private void WriteVersionUpdatesInfo() { var versionUpdatesInfo = LatestVersionCheck.GetLastRetrievedVersionUpdatesInfo(); using (ServerStore.ContextPool.AllocateOperationContext(out JsonOperationContext context)) { using (var writer = new BlittableJsonTextWriter(context, ResponseBodyStream())) { context.Write(writer, new DynamicJsonValue { [nameof(LatestVersionCheck.VersionInfo.Version)] = versionUpdatesInfo?.Version, [nameof(LatestVersionCheck.VersionInfo.PublishedAt)] = versionUpdatesInfo?.PublishedAt, [nameof(LatestVersionCheck.VersionInfo.BuildNumber)] = versionUpdatesInfo?.BuildNumber }); } } }
public RavenServer(RavenConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } Configuration = configuration; if (Configuration.Initialized == false) { throw new InvalidOperationException("Configuration must be initialized"); } ServerStore = new ServerStore(Configuration); Metrics = new MetricsCountersManager(); ServerMaintenanceTimer = new Timer(ServerMaintenanceTimerByMinute, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1)); _logger = LoggingSource.Instance.GetLogger <RavenServer>("Raven/Server"); _tcpLogger = LoggingSource.Instance.GetLogger <RavenServer>("<TcpServer>"); _latestVersionCheck = new LatestVersionCheck(ServerStore); }