fix(editor): server jobs, stale proxies and read-only accounts in the remote editor
- A server sequence whose cached frames are no longer the server's (a load, a 409 merge or a frames change event finds other frame ids) turns read-only and says why; opening it, or a sequence without cached proxies, queues the proxy download and opens it when done. Signed out reads "Connect to the server". - Server jobs show queued, running (with a bar), paused and analysing glyphs in the header with Cancel; a failed or cancelled one raises a toast with Retry. Progress alone no longer refreshes the whole editor. - The server job list is read by state and kind to its last page; "Add to queue" sets the job's priority; the event listener survives any failure and always releases its frames and connection. - An account that may render but not edit picks the preset to render without changing the project; preset cards and their batch boxes say why they wait. - Export tab of a server sequence: no local encoder, notices or folder; no Jobs history link. Sync at 12 px beside a folder that keeps 96 px and trims. - Restore's Undo puts back the project from before the restore, only while that restore is the editor's last change. - Export "Sync" of a render that ends while the session is down is queued for the saved session's server; skips are logged; sync follows the engine before it starts. - Capture: sequence-remote-export, -running and -readonly, and sequence-export-copies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
27 files changed
+932
-173
No files matched your search
@@ -12,7 +12,8 @@ public delegate IRemoteSequenceApi RemoteSequenceApiFactory(Uri address, string
|
||||
/// <summary><see cref="IRemoteSequenceApi"/> over a signed-in <see cref="TitanoClient"/>, which it owns.</summary>
|
||||
public sealed class TitanoRemoteSequenceApi(TitanoClient client) : IRemoteSequenceApi
|
||||
{
|
||||
private static readonly string[] ActiveStates = [JobWire.State(JobState.Queued), JobWire.State(JobState.Running), JobWire.State(JobState.Paused)];
|
||||
private static readonly JobState[] ActiveStates = [JobState.Queued, JobState.Running, JobState.Paused];
|
||||
private static readonly JobKind[] EditorKinds = [JobKind.DeepAnalyse, JobKind.LightAnalyse, JobKind.Render];
|
||||
|
||||
public Task<SequenceDto> GetSequenceAsync(Guid id, CancellationToken cancellationToken) => client.GetSequenceAsync(id, cancellationToken);
|
||||
|
||||
@@ -27,13 +28,34 @@ public sealed class TitanoRemoteSequenceApi(TitanoClient client) : IRemoteSequen
|
||||
|
||||
public Task<JobDto> GetJobAsync(Guid id, CancellationToken cancellationToken) => client.GetJobAsync(id, cancellationToken);
|
||||
|
||||
/// <summary>Filtered by state and kind and read to the last page: a busy server queues thumbnails and proxies by the thousand.</summary>
|
||||
public async Task<IReadOnlyList<JobDto>> ListActiveJobsAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var jobs = new List<JobDto>();
|
||||
foreach (var state in ActiveStates) jobs.AddRange((await client.ListJobsAsync(state, null, cancellationToken)).Items);
|
||||
foreach (var state in ActiveStates)
|
||||
{
|
||||
foreach (var kind in EditorKinds)
|
||||
{
|
||||
string? cursor = null;
|
||||
do
|
||||
{
|
||||
var page = await client.ListJobsAsync(JobWire.State(state), JobWire.Kind(kind), cursor, cancellationToken);
|
||||
jobs.AddRange(page.Items);
|
||||
cursor = page.NextCursor;
|
||||
}
|
||||
while (cursor is not null);
|
||||
}
|
||||
}
|
||||
return jobs;
|
||||
}
|
||||
|
||||
public Task<JobDto> CancelJobAsync(Guid id, CancellationToken cancellationToken) => client.CancelJobAsync(id, cancellationToken);
|
||||
|
||||
public Task<JobDto> RetryJobAsync(Guid id, CancellationToken cancellationToken) => client.RetryJobAsync(id, cancellationToken);
|
||||
|
||||
public Task<JobDto> SetJobPriorityAsync(Guid id, string priority, CancellationToken cancellationToken) =>
|
||||
client.SetJobPriorityAsync(id, priority, cancellationToken);
|
||||
|
||||
public IAsyncEnumerable<ServerEvent> EventsAsync(CancellationToken cancellationToken) => client.EventsAsync(cancellationToken);
|
||||
|
||||
public void Dispose() => client.Dispose();
|
||||
|
||||
@@ -146,19 +146,35 @@ public sealed class SyncHost(AppServices services) : ISyncConnector, IAsyncDispo
|
||||
|
||||
private bool Allows(Permissions permission) => services.Server.User is { } user && (user.Permissions & (long)permission) != 0;
|
||||
|
||||
/// <summary>Export "Sync": a render of this PC that asked for it is sent to the server once done (<see cref="ExportSync"/>).</summary>
|
||||
/// <summary>
|
||||
/// Export "Sync": a render of this PC that asked for it is sent to the server once done (<see cref="ExportSync"/>),
|
||||
/// also when it ends while the session is down: the send is queued for the saved session's server and waits for it.
|
||||
/// </summary>
|
||||
private void OnJobChanged(Job job)
|
||||
{
|
||||
if (job is not { Kind: JobKind.Render, State: JobState.Done } || Service is not { } service || services.Database is not { } db || _renders is not { } engine)
|
||||
return;
|
||||
_ = SendRenderAsync(new ExportSync(db, service, engine), job);
|
||||
var signedIn = Server;
|
||||
_ = SendRenderAsync(new ExportSync(db, service, engine), job, signedIn ?? SavedServer(), signedIn is null || CanUpload);
|
||||
}
|
||||
|
||||
private async Task SendRenderAsync(ExportSync exports, Job job)
|
||||
/// <summary>Key of the server of the saved session (Disconnect keeps it); null without one.</summary>
|
||||
private string? SavedServer() =>
|
||||
services.Server.HasSavedSession && ServerAddress.TryParse(services.Settings.ServerUrl, out var address) ? SyncService.ServerKey(address) : null;
|
||||
|
||||
private static async Task SendRenderAsync(ExportSync exports, Job job, string? server, bool canUpload)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (await exports.SendAsync(job, Server, CanUpload) is { } send) Log.Info("sync", $"{job.TargetLabel} will be sent to the server (job {send.Id})");
|
||||
switch (await exports.SendAsync(job, server, canUpload))
|
||||
{
|
||||
case { Send: { } send }:
|
||||
Log.Info("sync", $"{job.TargetLabel} will be sent to the server (job {send.Id})");
|
||||
break;
|
||||
case { Gate: var gate }:
|
||||
Log.Warning("sync", $"{job.TargetLabel} asked to be sent to the server but was not ({gate})");
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (ex is not OutOfMemoryException)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user