public async Task Idle() { //var name = GetStringQueryString("name", required: false); var maxTimeDatabaseCanBeIdle = ServerStore.Configuration.Databases.MaxIdleTime.AsTimeSpan; var results = new List <DynamicJsonValue>(); foreach (var databaseKvp in ServerStore.DatabasesLandlord.LastRecentlyUsed.ForceEnumerateInThreadSafeManner()) { var statistics = new IdleDatabaseStatistics { Name = databaseKvp.Key.ToString() }; statistics.CanCleanup = ServerStore.CanUnloadDatabase(databaseKvp.Key, databaseKvp.Value, maxTimeDatabaseCanBeIdle, statistics, out _); results.Add(statistics.ToJson()); } using (ServerStore.ContextPool.AllocateOperationContext(out TransactionOperationContext context)) await using (var writer = new AsyncBlittableJsonTextWriter(context, ResponseBodyStream())) { writer.WriteStartObject(); writer.WritePropertyName(nameof(DatabaseConfiguration.MaxIdleTime)); writer.WriteString(maxTimeDatabaseCanBeIdle.ToString()); writer.WriteComma(); writer.WritePropertyName(nameof(DatabaseConfiguration.FrequencyToCheckForIdle)); writer.WriteString(ServerStore.Configuration.Databases.FrequencyToCheckForIdle.AsTimeSpan.ToString()); writer.WriteComma(); writer.WriteArray("Results", results, context); writer.WriteEndObject(); } }