예제 #1
0
        public async Task GetVersionUpdatesInfo()
        {
            var shouldRefresh = GetBoolValueQueryString("refresh", required: false) ?? false;

            if (shouldRefresh && IsLatestVersionCheckThrottled() == false)
            {
                await LatestVersionCheck.PerformAsync();

                _lastRunAt = SystemTime.UtcNow;
            }

            WriteVersionUpdatesInfo();
        }
예제 #2
0
        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
                    });
                }
            }
        }
예제 #3
0
        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);
        }