Moved temporary files into a folder of their own below the data directory (#1245)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-29 18:45:34 +01:00
1 parent ddfc632b63
commit 12d3e1ec6c
52 files changed
+1219 -396

No files matched your search

+7 -3
View File
@@ -120,6 +120,7 @@ internal sealed class Program
}
var runtimeInfo = await rust.GetRuntimeInfo();
var tauriDataDirectory = await rust.GetDataDirectory();
var builder = WebApplication.CreateBuilder();
builder.WebHost.ConfigureKestrel(kestrelServerOptions =>
{
@@ -145,7 +146,6 @@ internal sealed class Program
{
try
{
var tauriDataDirectory = await rust.GetDataDirectory();
if(string.IsNullOrWhiteSpace(tauriDataDirectory))
throw new InvalidOperationException("Rust returned an empty Tauri data directory.");
@@ -276,7 +276,6 @@ internal sealed class Program
builder.Services.AddTransient<AssistantPluginAuditService>();
builder.Services.AddHostedService<UpdateService>();
builder.Services.AddHostedService<TemporaryChatService>();
builder.Services.AddHostedService<TranscriptStagingCleanupService>();
builder.Services.AddHostedService<ProvenanceCleanupService>();
builder.Services.AddHostedService<DataRestoreFollowUpService>();
@@ -353,6 +352,10 @@ internal sealed class Program
var programLogger = app.Services.GetRequiredService<ILogger<Program>>();
programLogger.LogInformation("Starting the AI Studio server.");
// Before any service runs, since emptying the temporary folder deletes what an operation writes there:
var temporaryFilesLogger = LOGGER_FACTORY.CreateLogger(nameof(TemporaryFiles));
TemporaryFiles.Initialize(tauriDataDirectory, temporaryFilesLogger);
//
// Observe tasks whose exceptions nobody awaited. We register this before the server starts:
// otherwise, everything the startup does — the plugin system, the first message bus traffic —
@@ -432,7 +435,8 @@ internal sealed class Program
programLogger.LogInformation("The AI Studio server is ready.");
await serverTask;
TemporaryFiles.Clear(temporaryFilesLogger);
RUST_SERVICE.Dispose();
DATABASE_CLIENT_PROVIDER.Dispose();
PluginFactory.Dispose();