Raccolta: 429 del CDN come rallentamento, attese crescenti e recupero dei falliti, storico e seguiti senza pagina di ripresa, lacuna sotto la prima pagina, eliminazioni durante lo scaricamento (regole-3, cdn-429, dl-1, post-loop, walk-1, check-1, scroll-1, reader-1, h9-1, ring-1, library-2, dedup-1, tmp-1, budget-1, regole-4, kind-1, vocab-1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
28 files changed
+2619
-200
No files matched your search
@@ -119,7 +119,7 @@ internal sealed class MediaStore(FebeDatabase db) : IMediaStore
|
||||
},
|
||||
ct);
|
||||
|
||||
public Task MarkStoredAsync(long mediaId, StoredFile file, MediaState state, DateTimeOffset at, CancellationToken ct = default)
|
||||
public Task<bool> MarkStoredAsync(long mediaId, StoredFile file, MediaState state, DateTimeOffset at, CancellationToken ct = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(file);
|
||||
if (!EntryStateRules.IsPresent(state))
|
||||
@@ -127,15 +127,18 @@ internal sealed class MediaStore(FebeDatabase db) : IMediaStore
|
||||
throw new ArgumentException("Un file salvato è «scaricato» o «importato».", nameof(state));
|
||||
}
|
||||
|
||||
return db.WriteAsync(
|
||||
return db.WriteAsync<bool>(
|
||||
w =>
|
||||
{
|
||||
var entryId = EntryOf(w, mediaId);
|
||||
w.Command("""
|
||||
|
||||
// A deletion «ricordando la scelta» wins over a file that arrives afterwards.
|
||||
var rows = w.Command("""
|
||||
UPDATE media SET state = @state, relative_path = @path, bytes = @bytes, sha256 = @sha, phash = @phash,
|
||||
width = COALESCE(@w, width), height = COALESCE(@h, height), duration_ms = COALESCE(@d, duration_ms),
|
||||
has_thumbnail = @thumb, downloaded_at = @at, last_error = NULL, source_url = NULL, cover_url = NULL
|
||||
WHERE id = @id
|
||||
WHERE id = @id AND state <> 'Deleted'
|
||||
AND (SELECT e.state FROM entry e WHERE e.id = media.entry_id) <> 'Deleted'
|
||||
""")
|
||||
.With("@state", Sql.Enum(state))
|
||||
.With("@path", file.RelativePath)
|
||||
@@ -149,7 +152,13 @@ internal sealed class MediaStore(FebeDatabase db) : IMediaStore
|
||||
.With("@at", Sql.Time(at))
|
||||
.With("@id", mediaId)
|
||||
.ExecuteNonQuery();
|
||||
if (rows == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RecomputeState(w, entryId, at);
|
||||
return true;
|
||||
},
|
||||
ct);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user