fix(sync): replace cached thumbnails once the server has the proxies

A proxy download caches a frame's thumbnail under its proxy name while
the server has no proxy of it (HEIF until a client or render node sends
one). The cache did not record which it was, so the thumbnail stayed
there for good after the server's proxies arrived (V-29).

- remote.json records each cached file's kind (proxy or thumbnail); a
  later proxy download replaces thumbnails, and files of caches written
  before kinds were kept, once the server offers the frame's proxy.
- A cache filled with thumbnails while the server had no proxies counts
  as stale, so offline caches are fetched again when the proxies arrive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-12 16:22:50 +00:00
1 parent f4103d42a1
commit b0c364539d
4 files changed
+101 -30

No files matched your search

+7 -3
View File
@@ -407,14 +407,18 @@ public sealed class SyncService
await RefreshSequencesAsync(remote, [remoteId], CompareOnly, cancellationToken).ConfigureAwait(false);
}
/// <summary>Records what the proxy cache holds for a server sequence.</summary>
internal async Task SetProxiesAsync(string server, SequenceDto dto, int cached, int framesVersion, CancellationToken cancellationToken)
/// <summary>
/// Records what the proxy cache holds for a server sequence. Thumbnails standing in for proxies the server did not
/// have leave the cache stale: it is filled again once the server has its proxies.
/// </summary>
internal async Task SetProxiesAsync(string server, SequenceDto dto, int cached, int thumbnails, int framesVersion, CancellationToken cancellationToken)
{
await _gate.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{
var link = Observe(await _links.GetAsync(server, dto.Id, cancellationToken).ConfigureAwait(false), server, dto);
await _links.UpsertAsync(link with { ProxiesCached = cached, ProxiesFramesVersion = framesVersion }, cancellationToken).ConfigureAwait(false);
int? filledAt = thumbnails > 0 && !link.ServerHasProxies ? null : framesVersion;
await _links.UpsertAsync(link with { ProxiesCached = cached, ProxiesFramesVersion = filledAt }, cancellationToken).ConfigureAwait(false);
}
finally
{