fix: stalled jobs, editor cancellation stops and GoPro DNG decoding

Owner review 1, phase 1 (docs/requests/2026-10-15-owner-review-1.md).

Thumbnail and proxy jobs over several sequences counted sequences while
they checkpointed inside one: the rate decayed until the time left
overflowed TimeSpan, the job failed while publishing progress and again
while saving it, and stayed Running. The throughput is now seeded by the
first window with progress, the time left is bounded (JobEta), saving
progress never throws, image passes count frames, and job speeds use the
right unit (bytes for verify and import).

The debugger stops in WicDecoderProvider.cs when presets changed were
cancelled preview decodes leaving synchronous thread-pool delegates; the
editor's sources, LatestRunner and the render node's proxy task now keep
them in their own tasks, and a cancellation is never an unreadable frame.

GoPro DNGs converted by Adobe software were classified GPR and read only
through their 8-bit preview, and Windows' preview-only DNG decoder was
reported as a native decode. A DNG is GPR only when its raw image is
VC-5, WIC decodes RAW only through the Raw Image Extension and never DNG,
analyses and previews take an adequate embedded preview by choice while
renders develop natively, and frames already indexed as GPR are
reclassified by the next light analysis.

Also records the owner's request (docs/requests), the BRIEF amendments
(§8.1, §8.2, new §24), DECISIONS, CHANGELOG, STATUS and ARCHITECTURE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-10-16 10:20:26 +02:00
1 parent 19265b36c2
commit 34d03051f5
77 files changed
+785 -94

No files matched your search

+15 -4
View File
@@ -22,7 +22,9 @@ internal sealed class FrameTiers(TitanoDatabase db, SequenceWriter writer, Archi
/// The tier of every frame of <paramref name="manifest"/> whose tier is not known yet, that decodes only through a
/// preview whose size is not known (the output cap needs it), or that is a GPR whose JPEG in another sequence
/// (<see cref="GprCompanions"/>; an upload may index it after the GPR was probed) is larger than its stored preview,
/// probed with the host's decoders without decoding pixels; missing and unreadable files are left for later.
/// or that is stored as GPR without the .gpr extension (indexed before GoPro DNGs converted by Adobe software counted as
/// DNG; R4, owner review 1), probed with the host's decoders without decoding pixels; missing and unreadable files are
/// left for later.
/// </summary>
public async Task<Dictionary<Guid, FileTier>> ProbeUnknownAsync(Archive archive, SequencePaths folder, SequenceManifest manifest,
CancellationToken cancellationToken)
@@ -30,7 +32,7 @@ internal sealed class FrameTiers(TitanoDatabase db, SequenceWriter writer, Archi
var tiers = new Dictionary<Guid, FileTier>();
var present = manifest.Frames.Where(f => (f.Flags & FrameFlags.Missing) == 0).ToList();
var companions = await GprCompanions.FindWithSizesAsync(db, archive, present, cancellationToken).ConfigureAwait(false);
var unknown = present.Where(f => f.Tier == 0 || (f.Tier == DecodeTier.EmbeddedPreview && f.PreviewW is null)
var unknown = present.Where(f => f.Tier == 0 || (f.Tier == DecodeTier.EmbeddedPreview && f.PreviewW is null) || IsStaleGpr(f)
|| (companions.TryGetValue(f.Id, out var jpeg)
&& int.Max(f.PreviewW ?? 0, f.PreviewH ?? 0) < int.Max(jpeg.Width, jpeg.Height)));
foreach (var frame in unknown)
@@ -97,7 +99,8 @@ internal sealed class FrameTiers(TitanoDatabase db, SequenceWriter writer, Archi
if (tier is not null) updated = SequenceFrames.WithTier(frame, tier, DecodesNatively(frame.Format), proxied == true);
else if (proxied is { } own) updated = SequenceFrames.WithProxy(frame, own);
else continue;
if (updated.Tier == frame.Tier && updated.Flags == frame.Flags && updated.PreviewW == frame.PreviewW && updated.PreviewH == frame.PreviewH)
if (updated.Tier == frame.Tier && updated.Flags == frame.Flags && updated.PreviewW == frame.PreviewW && updated.PreviewH == frame.PreviewH
&& updated.Format == frame.Format)
continue;
gained |= (updated.Flags & ~frame.Flags & FrameFlags.Undecodable) != 0;
frames[i] = updated;
@@ -118,7 +121,7 @@ internal sealed class FrameTiers(TitanoDatabase db, SequenceWriter writer, Archi
// for these frames while this waits for the row, and PostgreSQL would abort one of them.
await tx.Sequences.RecordTiersAsync(sequence.Id, gained ? SequenceStatus.HasWarnings : SequenceStatus.None,
frames.Count(f => (f.Flags & FrameFlags.PreviewOnly) != 0), cancellationToken).ConfigureAwait(false);
await tx.Frames.UpdateTiersAsync(changed.ConvertAll(f => new FrameTierFields(f.Id, f.Flags, f.PreviewW ?? 0, f.PreviewH ?? 0)), cancellationToken)
await tx.Frames.UpdateTiersAsync(changed.ConvertAll(f => new FrameTierFields(f.Id, f.Flags, f.PreviewW ?? 0, f.PreviewH ?? 0, f.Format)), cancellationToken)
.ConfigureAwait(false);
await tx.CommitAsync(cancellationToken).ConfigureAwait(false);
}
@@ -127,6 +130,14 @@ internal sealed class FrameTiers(TitanoDatabase db, SequenceWriter writer, Archi
}
}
/// <summary>
/// A frame stored as GPR whose file is not a .gpr: before owner review 1 every DNG with Make=GoPro counted as GPR, so
/// Adobe-converted GoPro DNGs were recorded preview-only; probing reads its signature again (<see cref="SequenceFrames.WithTier"/>
/// then stores the format found).
/// </summary>
internal static bool IsStaleGpr(SidecarFrame frame) =>
frame.Format == ImageFileFormat.Gpr && !frame.File.EndsWith(".gpr", StringComparison.OrdinalIgnoreCase);
/// <summary>
/// Whether this host decodes <paramref name="format"/> natively, so a file of it that yields no pixels is damaged
/// rather than beyond this host (JPEG always: the managed JPEG decoder is part of every host).
@@ -6,8 +6,9 @@ using Titano.Data.Jobs;
namespace Titano.Data.Archiving.Jobs;
/// <summary>
/// <see cref="JobKind.Thumbs"/> and <see cref="JobKind.Proxies"/> over the target sequences. Progress counts
/// sequences; checkpoint: <c>sequence:frame</c>.
/// <see cref="JobKind.Thumbs"/> and <see cref="JobKind.Proxies"/> over the target sequences. Progress counts frames
/// across all targets, so the speed and time left follow the photos even inside a long sequence; checkpoint:
/// <c>sequence:frame</c>.
/// </summary>
internal sealed class ImageJobHandler(TitanoDatabase db, ArchiveImages images, JobKind kind) : IJobHandler
{
@@ -18,18 +19,29 @@ internal sealed class ImageJobHandler(TitanoDatabase db, ArchiveImages images, J
var force = ArchiveJobJson.Read(context.Job, ArchiveJobJson.Default.ImageJobParameters, new ImageJobParameters(false)).Force;
var (first, firstFrame) = Parse(context.Checkpoint);
var targets = context.Job.TargetIds;
var sequences = new Sequence?[targets.Count];
long total = 0;
for (var s = 0; s < targets.Count; s++)
{
sequences[s] = await db.Sequences.GetAsync(targets[s], context.Cancellation).ConfigureAwait(false);
total += sequences[s]?.FrameCount ?? 0;
}
long before = 0;
for (var s = 0; s < Math.Min(first, targets.Count); s++) before += sequences[s]?.FrameCount ?? 0;
for (var s = first; s < targets.Count; s++)
{
context.Cancellation.ThrowIfCancellationRequested();
if (await db.Sequences.GetAsync(targets[s], context.Cancellation).ConfigureAwait(false) is not { } sequence
if (sequences[s] is not { } sequence
|| await db.Archives.GetAsync(sequence.ArchiveId, context.Cancellation).ConfigureAwait(false) is not { } archive)
{
context.Log(Loc.L("Archive.Log.SequenceMissing", targets[s]));
before += sequences[s]?.FrameCount ?? 0;
continue;
}
var index = s;
var offset = before;
ValueTask Checkpoint(int nextFrame, int frames) =>
context.CheckpointAsync(string.Create(CultureInfo.InvariantCulture, $"{index}:{nextFrame}"), index, targets.Count);
context.CheckpointAsync(string.Create(CultureInfo.InvariantCulture, $"{index}:{nextFrame}"), Math.Min(total, offset + nextFrame), total);
var start = s == first ? firstFrame : 0;
var result = kind == JobKind.Thumbs
? await images.BuildThumbnailsAsync(archive, sequence, force, start, Checkpoint, context.Cancellation).ConfigureAwait(false)
@@ -37,7 +49,8 @@ internal sealed class ImageJobHandler(TitanoDatabase db, ArchiveImages images, J
context.Log(kind == JobKind.Thumbs
? Loc.L("Archive.Log.ImagesDone", sequence.DisplayTitle, result.Built, result.Reused, result.Undecodable)
: Loc.L("Archive.Log.ProxiesDone", sequence.DisplayTitle, result.Built, result.Reused, result.Undecodable, result.Waiting));
await context.CheckpointAsync(string.Create(CultureInfo.InvariantCulture, $"{s + 1}:0"), s + 1, targets.Count).ConfigureAwait(false);
before += sequence.FrameCount;
await context.CheckpointAsync(string.Create(CultureInfo.InvariantCulture, $"{s + 1}:0"), Math.Min(total, before), total).ConfigureAwait(false);
}
}
+27 -7
View File
@@ -23,6 +23,9 @@ public sealed record JobEngineOptions
/// <summary>Finished jobs older than this are purged (BRIEF §14.6: 90 days).</summary>
public TimeSpan HistoryRetention { get; init; } = TimeSpan.FromDays(90);
/// <summary>Clock of the throughput windows and the checkpoint interval (tests pass their own).</summary>
public TimeProvider Time { get; init; } = TimeProvider.System;
}
/// <summary>
@@ -182,17 +185,29 @@ public sealed class JobEngine : IAsyncDisposable
_shutdown.Dispose();
}
/// <summary>Broadcasts live progress. A subscriber that throws never fails the job it watches (logged once per job).</summary>
internal void PublishProgress(JobContext context)
{
var (rate, eta) = context.Rate();
Progress?.Invoke(new JobProgressInfo(context.Job.Id, context.Job.Kind, context.Job.TargetLabel, context.Done, context.Total, rate, eta, context.Message));
}
internal async Task<bool> PersistAsync(JobContext context)
{
var (rate, eta) = context.Rate();
try
{
var (rate, eta) = context.Rate();
Progress?.Invoke(new JobProgressInfo(context.Job.Id, context.Job.Kind, context.Job.TargetLabel, context.Done, context.Total, rate, eta, context.Message));
}
catch (Exception ex)
{
if (context.FirstProgressFailure()) Log.Warning("jobs", $"Progress of {context.Job.Kind} job {context.Job.Id} not published", ex);
}
}
/// <summary>
/// Saves progress, checkpoint and log tail; false when the job no longer runs here (cancelled or paused elsewhere).
/// Saving is best effort and never throws: a failure is logged and the job goes on, so its final state is always written.
/// </summary>
internal async Task<bool> PersistAsync(JobContext context)
{
try
{
var (rate, eta) = context.Rate();
return await _db.Jobs.UpdateProgressAsync(context.Job.Id, context.Done, context.Total, rate, eta, context.Checkpoint, context.LogTail, CancellationToken.None)
.ConfigureAwait(false);
}
@@ -201,6 +216,11 @@ public sealed class JobEngine : IAsyncDisposable
Log.Warning("jobs", "Progress not saved (transient database error)", ex);
return true;
}
catch (Exception ex)
{
Log.Warning("jobs", $"Progress of {context.Job.Kind} job {context.Job.Id} not saved", ex);
return true;
}
}
/// <summary>True when this engine claims jobs of <paramref name="kind"/> (it has a handler and the kind is not filtered out).</summary>
+17 -25
View File
@@ -1,4 +1,3 @@
using System.Diagnostics;
using System.Text;
using Titano.Core.Model;
@@ -39,23 +38,26 @@ public sealed class JobContext
{
private const int LogTailLines = 40;
private readonly JobEngine _engine;
private readonly Stopwatch _clock = Stopwatch.StartNew();
private readonly TimeProvider _time;
private readonly long _started;
private readonly Queue<string> _log = new();
private readonly Lock _gate = new();
private long _lastPersistTicks;
private long _rateDone;
private double _rateSeconds;
private double? _rate;
private readonly JobThroughput _throughput;
private long _lastPersist;
private int _progressFailures;
internal JobContext(JobEngine engine, Job job, CancellationToken cancellation)
{
_engine = engine;
_time = engine.Options.Time;
_started = _time.GetTimestamp();
_lastPersist = _started;
Job = job;
Cancellation = cancellation;
Checkpoint = job.Checkpoint;
Done = job.ProgressDone;
Total = job.ProgressTotal;
_rateDone = Done;
_throughput = new JobThroughput(Done);
if (job.LogTail is { Length: > 0 } tail)
{
foreach (var line in tail.Split('\n')) _log.Enqueue(line);
@@ -122,35 +124,25 @@ public sealed class JobContext
}
}
/// <summary>Throughput as a moving average over windows of at least two seconds, and the time left at that rate.</summary>
/// <summary>Throughput and time left (<see cref="JobThroughput"/>); never throws, whatever the progress reported.</summary>
internal (double? Rate, TimeSpan? Eta) Rate()
{
lock (_gate)
{
var seconds = _clock.Elapsed.TotalSeconds;
var span = seconds - _rateSeconds;
if (span >= 2 && Done >= _rateDone)
{
var sample = (Done - _rateDone) / span;
_rate = _rate is { } previous ? previous * 0.7 + sample * 0.3 : sample;
_rateDone = Done;
_rateSeconds = seconds;
}
TimeSpan? eta = _rate is > 0 && Total > Done ? TimeSpan.FromSeconds((Total - Done) / _rate.Value) : null;
return (_rate, eta);
}
lock (_gate) return _throughput.Sample(_time.GetElapsedTime(_started).TotalSeconds, Done, Total);
}
/// <summary>True the first time publishing this job's progress failed, so the failure is logged once.</summary>
internal bool FirstProgressFailure() => Interlocked.Increment(ref _progressFailures) == 1;
private async ValueTask ReportCoreAsync(long done, long total, string? message, bool force)
{
Done = done;
Total = total;
Message = message;
var now = _clock.ElapsedTicks;
var due = now - Interlocked.Read(ref _lastPersistTicks) >= _engine.Options.CheckpointInterval.TotalSeconds * Stopwatch.Frequency;
var now = _time.GetTimestamp();
var due = _time.GetElapsedTime(Interlocked.Read(ref _lastPersist), now) >= _engine.Options.CheckpointInterval;
_engine.PublishProgress(this);
if (!force && !due) return;
Interlocked.Exchange(ref _lastPersistTicks, now);
Interlocked.Exchange(ref _lastPersist, now);
if (!await _engine.PersistAsync(this).ConfigureAwait(false))
_engine.StopJob(Job.Id); // cancelled or paused by someone else
}
+58
View File
@@ -0,0 +1,58 @@
namespace Titano.Data.Jobs;
/// <summary>
/// Time left of a job: unknown (null) when nothing remains, the rate is unknown, or the result is not a finite duration
/// of at most <see cref="Max"/>. Every conversion of a stored or reported time left goes through here, so a stalled job
/// shows no time left instead of overflowing <see cref="TimeSpan"/>.
/// </summary>
public static class JobEta
{
/// <summary>Longest time left worth showing; beyond it the job reads as stalled.</summary>
public static readonly TimeSpan Max = TimeSpan.FromDays(365);
/// <summary>The time <paramref name="remaining"/> items take at <paramref name="perSecond"/>.</summary>
public static TimeSpan? Of(long remaining, double? perSecond) =>
remaining > 0 && perSecond is > 0 and var rate ? FromSeconds(remaining / rate) : null;
/// <summary>A stored or reported number of seconds as a time left, or null when it is not a usable one.</summary>
public static TimeSpan? FromSeconds(double? seconds) =>
seconds is { } s && double.IsFinite(s) && s >= 0 && s <= Max.TotalSeconds ? TimeSpan.FromSeconds(s) : null;
}
/// <summary>
/// Throughput of a running job as a moving average over windows of at least two seconds. The first window that saw
/// progress seeds the average; each later window weighs 30 %. A window without progress lowers the rate, which tends to
/// zero without reaching it: below <see cref="MinRate"/> it reads as unknown, and the time left with it.
/// </summary>
internal sealed class JobThroughput(long done)
{
private const double WindowSeconds = 2;
/// <summary>Items per second below which a job counts as stalled.</summary>
internal const double MinRate = 1e-6;
private long _done = done;
private double _seconds;
private double? _rate;
/// <summary>Takes a sample at <paramref name="seconds"/> since the job started and returns the rate and time left.</summary>
public (double? Rate, TimeSpan? Eta) Sample(double seconds, long done, long total)
{
if (done < _done)
{
// Progress went back (a handler restarted its count): start a new window there.
_done = done;
_seconds = seconds;
}
else if (seconds - _seconds >= WindowSeconds)
{
var sample = (done - _done) / (seconds - _seconds);
if (_rate is { } previous) _rate = previous * 0.7 + sample * 0.3;
else if (sample > 0) _rate = sample;
_done = done;
_seconds = seconds;
}
var rate = _rate is >= MinRate ? _rate : null;
return (rate, JobEta.Of(total - done, rate));
}
}
+1 -1
View File
@@ -48,7 +48,7 @@ public static class JobWire
ProgressDone = dto.ProgressDone,
ProgressTotal = dto.ProgressTotal,
ItemsPerSecond = dto.ItemsPerSecond,
Eta = dto.EtaSeconds is { } eta ? TimeSpan.FromSeconds(eta) : null,
Eta = JobEta.FromSeconds(dto.EtaSeconds),
LogTail = dto.LogTail,
NodeId = dto.NodeId,
Attempts = dto.Attempts,
@@ -40,10 +40,14 @@ internal static class AnalysisFollowUp
await context.EnqueueFollowUpAsync(request.Kind, request.Targets, request.Label, request.ParametersJson, request.Priority).ConfigureAwait(false);
}
/// <summary>Sequences of <paramref name="archiveId"/> without a current light analysis (new, adopted, or with frames a scan added).</summary>
/// <summary>
/// Sequences of <paramref name="archiveId"/> without a current light analysis (new, adopted, or with frames a scan added),
/// and those with frames stored as GPR that are DNGs: the light analysis probes them again and records the DNG format
/// and its native tier (R4, owner review 1).
/// </summary>
public static async Task<List<Guid>> UnanalysedAsync(TitanoDatabase db, Guid archiveId, CancellationToken cancellationToken)
{
var ids = new List<Guid>();
var ids = new List<Guid>(await db.Frames.ListSequencesWithStaleGprAsync(archiveId, cancellationToken).ConfigureAwait(false));
var query = new SequenceQuery { ArchiveId = archiveId, WithoutStatus = SequenceStatus.AnalyzedLight, Sort = SequenceSort.Oldest, Limit = 1000 };
do
{
@@ -52,6 +56,6 @@ internal static class AnalysisFollowUp
query = query with { Cursor = page.NextCursor };
}
while (query.Cursor is not null);
return ids;
return [.. ids.Distinct()];
}
}
@@ -300,8 +300,11 @@ public sealed class RenderNodeClient : IAsyncDisposable
}
try
{
var jpeg = await Task.Run(() => ArchiveImages.MakeProxy(_processing.Archive.Decoder, original, frame, camera, spec.LongEdge, spec.Quality,
cancellationToken), cancellationToken).ConfigureAwait(false);
var jpeg = await Task.Run(async () =>
{
await Task.Yield();
return ArchiveImages.MakeProxy(_processing.Archive.Decoder, original, frame, camera, spec.LongEdge, spec.Quality, cancellationToken);
}, cancellationToken).ConfigureAwait(false);
if (jpeg is null)
{
unsent++;
@@ -191,7 +191,9 @@ internal sealed class SequenceFrameSource : IFrameSource, IRenderFrameSource, IA
try
{
var companion = proxied ? null : Companions?.GetValueOrDefault(frame.Id);
decoded = _decoder.Decode(new DecodeRequest(file, maxLongEdge, purpose, Companion: companion), cancellationToken);
// Analyses and previews take an adequate embedded preview of a RAW (fast); renders develop it (R4, owner review 1).
decoded = _decoder.Decode(new DecodeRequest(file, maxLongEdge, purpose, Companion: companion, PreferPreview: purpose != DecodePurpose.Render),
cancellationToken);
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{
@@ -200,7 +202,8 @@ internal sealed class SequenceFrameSource : IFrameSource, IRenderFrameSource, IA
return null;
}
// A file that vanished is missing, not undecodable (a verify flags it); only what decoding found is recorded.
if (Originals && !proxied && (decoded is not null || File.Exists(file)))
// A preview taken by choice says how these pixels were made, not what the file can give.
if (Originals && !proxied && decoded is not { ByChoice: true } && (decoded is not null || File.Exists(file)))
{
_observed[index] = decoded switch
{
+23 -12
View File
@@ -23,7 +23,7 @@ public sealed record DuplicateFrame(string Sha256, Guid FrameId, Guid SequenceId
public readonly record struct FrameLightStats(Guid FrameId, double? MeanLogLuminance, double? ClipLow, double? ClipHigh);
/// <summary>Decode-tier fields of one frame (BRIEF §8.2): its flags and the stored size of its largest embedded preview.</summary>
public readonly record struct FrameTierFields(Guid FrameId, FrameFlags Flags, int PreviewWidth, int PreviewHeight);
public readonly record struct FrameTierFields(Guid FrameId, FrameFlags Flags, int PreviewWidth, int PreviewHeight, ImageFileFormat Format);
/// <summary>Per-format totals and flagged-frame counts of one sequence.</summary>
public sealed record SequenceFrameStats(IReadOnlyList<FormatBucket> ByFormat, long Missing, long Corrupt, long Duplicate, long Excluded);
@@ -175,19 +175,20 @@ public sealed class FrameRepository
for (var start = 0; start < frames.Count; start += Batch)
{
var count = Math.Min(Batch, frames.Count - start);
var sql = new StringBuilder("UPDATE frames AS f SET flags = v.fl, preview_width = v.w, preview_height = v.h FROM (VALUES ");
var args = new DbParam[count * 4];
var sql = new StringBuilder("UPDATE frames AS f SET flags = v.fl, preview_width = v.w, preview_height = v.h, format = v.fmt FROM (VALUES ");
var args = new DbParam[count * 5];
for (var i = 0; i < count; i++)
{
var f = frames[start + i];
sql.Append(i > 0 ? ", (" : "(").Append('$').Append(4 * i + 1).Append(", $").Append(4 * i + 2)
.Append(", $").Append(4 * i + 3).Append(", $").Append(4 * i + 4).Append(')');
args[4 * i] = f.FrameId;
args[4 * i + 1] = (int)f.Flags;
args[4 * i + 2] = f.PreviewWidth;
args[4 * i + 3] = f.PreviewHeight;
sql.Append(i > 0 ? ", (" : "(").Append('$').Append(5 * i + 1).Append(", $").Append(5 * i + 2)
.Append(", $").Append(5 * i + 3).Append(", $").Append(5 * i + 4).Append(", $").Append(5 * i + 5).Append(')');
args[5 * i] = f.FrameId;
args[5 * i + 1] = (int)f.Flags;
args[5 * i + 2] = f.PreviewWidth;
args[5 * i + 3] = f.PreviewHeight;
args[5 * i + 4] = (int)f.Format;
}
sql.Append(") AS v(id, fl, w, h) WHERE f.id = v.id");
sql.Append(") AS v(id, fl, w, h, fmt) WHERE f.id = v.id");
updated += await session.ExecuteAsync(sql.ToString(), args, cancellationToken).ConfigureAwait(false);
}
}
@@ -195,8 +196,8 @@ public sealed class FrameRepository
{
foreach (var f in frames)
{
updated += await session.ExecuteAsync("UPDATE frames SET flags = $2, preview_width = $3, preview_height = $4 WHERE id = $1",
[f.FrameId, (int)f.Flags, f.PreviewWidth, f.PreviewHeight], cancellationToken).ConfigureAwait(false);
updated += await session.ExecuteAsync("UPDATE frames SET flags = $2, preview_width = $3, preview_height = $4, format = $5 WHERE id = $1",
[f.FrameId, (int)f.Flags, f.PreviewWidth, f.PreviewHeight, (int)f.Format], cancellationToken).ConfigureAwait(false);
}
}
return updated;
@@ -263,6 +264,16 @@ public sealed class FrameRepository
"ORDER BY f.sha256, s.first_capture, f.sequence_id, f.idx",
[archiveId], r => new DuplicateFrame(r.GetString(0), r.GetGuid(1), r.GetGuid(2), r.GetInt32(3), r.GetString(4)), cancellationToken);
/// <summary>
/// Sequences of an archive with frames stored as GPR whose file is not a .gpr: indexed before GoPro DNGs converted by
/// Adobe software counted as DNG (R4, owner review 1); their next light analysis probes them again.
/// </summary>
public Task<IReadOnlyList<Guid>> ListSequencesWithStaleGprAsync(Guid archiveId, CancellationToken cancellationToken = default) =>
_db.ListAsync(
"SELECT DISTINCT f.sequence_id FROM frames f JOIN sequences s ON s.id = f.sequence_id " +
"WHERE s.archive_id = $1 AND f.format = $2 AND lower(f.file_name) NOT LIKE '%.gpr'",
[archiveId, (int)ImageFileFormat.Gpr], r => r.GetGuid(0), cancellationToken);
/// <summary>Frames of an archive that carry every bit of <paramref name="flags"/>.</summary>
public Task<IReadOnlyList<FrameRef>> ListFlaggedAsync(Guid archiveId, FrameFlags flags, CancellationToken cancellationToken = default) =>
_db.ListAsync(
@@ -1,5 +1,6 @@
using System.Globalization;
using Titano.Core.Model;
using Titano.Data.Jobs;
namespace Titano.Data.Repositories;
@@ -209,7 +210,7 @@ public sealed class JobRepository
ProgressDone = r.GetInt64(7),
ProgressTotal = r.GetInt64(8),
ItemsPerSecond = r.GetDoubleOrNull(9),
Eta = r.GetDoubleOrNull(10) is { } seconds ? TimeSpan.FromSeconds(seconds) : null,
Eta = JobEta.FromSeconds(r.GetDoubleOrNull(10)),
Checkpoint = r.GetStringOrNull(11),
LogTail = r.GetStringOrNull(12),
CreatedBy = r.GetGuidOrNull(13),