fix(processing): concurrent renders keep their own names; analysis status under the lock; server announces changes

A render reserves the output name it picks, so the same preset queued twice
no longer overwrites one output with the other; render rows take ids from
their job and entry, so a resumed job recognises only its own outputs and
never deletes another render's file. A light pass records its status under
the sequence lock and cannot clear a deep pass's. Renders and Auto value
changes made by the server engine publish sequenceChanged events.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 23:16:23 +00:00
1 parent 23c40ece6f
commit c7ca1ef463
9 files changed
+316 -56

No files matched your search

+20 -7
View File
@@ -5,7 +5,9 @@ using Titano.Data;
using Titano.Data.Archiving;
using Titano.Data.Jobs;
using Titano.Data.Processing;
using Titano.Protocol;
using Titano.Server.Configuration;
using Titano.Server.Events;
namespace Titano.Server.Storage;
@@ -13,19 +15,30 @@ namespace Titano.Server.Storage;
/// Analysis and render engine of the server (BRIEF §4.2, §10, §14.5, §14.6): light and deep analysis with managed
/// decoders (the light analysis queued after uploads runs here) and renders with managed encoders only. The render
/// handler takes just the jobs whose every output a managed encoder produces (AVI MJPEG, image sequences, GIF, APNG);
/// MP4 jobs stay queued for render nodes (BRIEF §14.7).
/// MP4 jobs stay queued for render nodes (BRIEF §14.7). Renders recorded and Auto values changed here reach connected
/// clients as <c>sequenceChanged</c> events (§14.3).
/// </summary>
public static class ProcessingModule
{
public static void Register(IServiceCollection services)
{
services.AddSingleton(sp => new ProcessingService(sp.GetRequiredService<TitanoDatabase>(), new ProcessingOptions
services.AddSingleton(sp =>
{
Archive = new ArchiveServiceOptions { Decoder = DecoderFactory.CreateServer(), Owner = ArchiveModule.Owner },
Encoders = [new ManagedEncoderProvider()],
Host = EncoderHost.Server,
ProducedBy = sp.GetRequiredService<ServerOptions>().ServerName,
}));
var db = sp.GetRequiredService<TitanoDatabase>();
var events = sp.GetRequiredService<EventHub>();
return new ProcessingService(db, new ProcessingOptions
{
Archive = new ArchiveServiceOptions { Decoder = DecoderFactory.CreateServer(), Owner = ArchiveModule.Owner },
Encoders = [new ManagedEncoderProvider()],
Host = EncoderHost.Server,
ProducedBy = sp.GetRequiredService<ServerOptions>().ServerName,
SequenceChanged = async (id, change, ct) =>
{
if (await db.Sequences.GetAsync(id, ct) is { } sequence)
events.Publish(new SequenceChangedEvent(id, change, sequence.FramesVersion, sequence.SettingsVersion));
},
});
});
services.AddSingleton<IJobHandlerProvider>(sp => sp.GetRequiredService<ProcessingService>());
}
}