Files
twotalesanimation 477aef7b27
Deploy / deploy (push) Successful in 3m25s
feat(worker): upload status in the job log, ProRes uploaded in the background
Preview jobs looked stuck after aerender finished: the worker was silently
uploading the review MP4s and the ProRes MOV over a slow uplink, and a
restart mid-upload threw the preview away.

- Worker 1.7.1 replaces the job's log tail with live upload status and logs
  each upload's size, duration and speed.
- The ProRes MOV now uploads after finalize via a persistent queue
  (HighResUploader, resumes after restart, 5 attempts) and attaches through
  the new E13b endpoint POST /api/ext/render/jobs/{id}/attach-highres.
  A MOV from a superseded preview is discarded.

Deploy the server before the 1.7.1 worker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 18:13:23 +02:00

43 lines
1.3 KiB
C#

using System.Net;
namespace VFXReviewWorker;
/// <summary>
/// StreamContent that reports bytes sent, so a long upload can show progress.
/// Length is computed from the stream, so the PUT still carries Content-Length
/// (presigned S3 uploads reject chunked bodies).
/// </summary>
internal sealed class ProgressStreamContent : HttpContent
{
private readonly Stream _source;
private readonly Action<long>? _onProgress;
public ProgressStreamContent(Stream source, Action<long>? onProgress)
{
_source = source;
_onProgress = onProgress;
}
protected override Task SerializeToStreamAsync(Stream stream, TransportContext? context) =>
SerializeToStreamAsync(stream, context, CancellationToken.None);
protected override async Task SerializeToStreamAsync(Stream stream, TransportContext? context, CancellationToken ct)
{
var buffer = new byte[81920];
long sent = 0;
int read;
while ((read = await _source.ReadAsync(buffer, ct)) > 0)
{
await stream.WriteAsync(buffer.AsMemory(0, read), ct);
sent += read;
_onProgress?.Invoke(sent);
}
}
protected override bool TryComputeLength(out long length)
{
length = _source.Length;
return true;
}
}