merge: bring phase 4b's final code (v0.1.0-rc.7) into phase 5a
Phase 5a was cut from an earlier phase 4b commit (e3cbe30b). This merges the final 4b head11d2c67e(squashed into main asefa87f68): fix rounds 2-3 of the mass conversion and the replaced-photo trash, the residuals, the 4b strings in the 36 other languages, and 4b's docs, so 5a builds on the code that was released. Conflicts: - JobRepository: 5a's ListPendingAsync (the workspace copies of a sequence) and 4b's ListHoldsAsync (what running and paused jobs hold, without the parameters) are both kept. - ARCHITECTURE: 4b's rows and paragraph kept whole, 5a's additions (projects, workspaces, the Edit picker, the WorkspaceCopy job) laid onto them; both paragraphs kept. The resx files merged cleanly: the 36 other cultures hold 4b's translations, and 5a's new keys stay untranslated there. JobKind values are unchanged (Backup 16, Cleanup 17, EmptyTrash 18, Convert 19, WorkspaceCopy 20). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
6e00c3c996
290 files changed
+14129
-884
No files matched your search
@@ -252,6 +252,51 @@ public sealed class JobEngineTests(TestContext context)
|
||||
Assert.Empty((await db.Jobs.ListAsync(null, JobKind.LightAnalyse)).Items);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A follow-up of work already done (a sync download's frame swapped to another encoding, whose thumbnails it cleared) is
|
||||
/// queued whatever stops its job meanwhile: a cancel arriving right after the work leaves it queued, and it runs.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task AFollowUpQueuedWhateverStopsItsJobOutlivesACancel()
|
||||
{
|
||||
await using var db = await OpenAsync();
|
||||
var target = Guid.CreateVersion7();
|
||||
var started = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
var queued = new TaskCompletionSource<Job?>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
var download = new CallbackHandler(JobKind.Scan, async c =>
|
||||
{
|
||||
started.TrySetResult();
|
||||
try
|
||||
{
|
||||
await Task.Delay(Timeout.InfiniteTimeSpan, c.Cancellation);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// The work is done; the cancel came before its follow-up was queued.
|
||||
}
|
||||
try
|
||||
{
|
||||
queued.TrySetResult(await c.EnqueueFollowUpAsync(JobKind.Thumbs, [target], "Roof", null, JobPriority.Background, CancellationToken.None));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
queued.TrySetException(ex);
|
||||
}
|
||||
c.Cancellation.ThrowIfCancellationRequested();
|
||||
});
|
||||
await using var engine = new JobEngine(db, [download, new CountingHandler(JobKind.Thumbs, 1)],
|
||||
new JobEngineOptions { Workers = 1, WorkerId = "t", PollInterval = TimeSpan.FromMilliseconds(50) });
|
||||
await engine.StartAsync();
|
||||
var job = await engine.EnqueueAsync(JobKind.Scan, []);
|
||||
await started.Task.WaitAsync(TimeSpan.FromSeconds(10));
|
||||
|
||||
await engine.CancelAsync(job.Id);
|
||||
|
||||
var followUp = Assert.NotNull(await queued.Task.WaitAsync(TimeSpan.FromSeconds(10)), "queued although its job was cancelled");
|
||||
await WaitForStateAsync(db, job.Id, JobState.Cancelled, TimeSpan.FromSeconds(5));
|
||||
Assert.SequenceEqual([target], (await WaitForStateAsync(db, followUp.Id, JobState.Done, TimeSpan.FromSeconds(10))).TargetIds);
|
||||
}
|
||||
|
||||
/// <summary>Waits until <paramref name="condition"/> holds, failing with <paramref name="what"/> after ten seconds.</summary>
|
||||
private static async Task UntilAsync(Func<bool> condition, string what)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user