fix(sync): keep a proxy cache stale while any frame lacks its proxy
A proxy download marked the cache filled whenever the server's sequence had ProxiesBuilt, even when frames added since the server's last proxy pass got a thumbnail or nothing (the flag offers their proxies, the endpoints answer 404 until the pass draws them), and frames without any cached file were not counted at all. The agent never compared such a cache again, so the editor kept thumbnails or blank frames until the frames changed. The cache now counts as filled only when every frame, missing or damaged ones aside, is cached as a proxy. On a server with ProxiesBuilt, a download that left stand-ins is queued again once the server's update time moves, so a frame the server cannot serve yet is not fetched at every refresh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
6 files changed
+123
-19
No files matched your search
@@ -39,6 +39,12 @@ internal sealed class FakeSyncRemote : ISyncRemote
|
||||
/// <summary>Proxy and thumbnail downloads fail with a server error.</summary>
|
||||
public bool FailAssets { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Assets (frame id, kind) the sequence's flags offer that the server has not drawn yet: frames added since its last
|
||||
/// thumbnail or proxy pass answer 404 until that pass ends, as the real endpoints do.
|
||||
/// </summary>
|
||||
public HashSet<(Guid Frame, string Kind)> Undrawn { get; } = [];
|
||||
|
||||
/// <summary>Proxies clients sent, by frame id (for sequences the server cannot decode).</summary>
|
||||
public Dictionary<Guid, byte[]> SentProxies { get; } = [];
|
||||
|
||||
@@ -174,6 +180,7 @@ internal sealed class FakeSyncRemote : ISyncRemote
|
||||
"original" when CorruptOnce == frameId => [.. frame.Bytes.Select(b => (byte)~b)],
|
||||
"original" => frame.Bytes,
|
||||
"proxy" or "thumb" when FailAssets => throw new TitanoApiException(HttpStatusCode.InternalServerError, new ApiError("internal", "failed")),
|
||||
"proxy" or "thumb" when Undrawn.Contains((frameId, kind)) => throw NotFound(),
|
||||
// A proxy a client or render node sent is served as soon as it is filed, like the manifest says.
|
||||
"proxy" when SentProxies.TryGetValue(frameId, out var sent) => sent,
|
||||
"proxy" when (sequence.Status & SequenceStatus.ProxiesBuilt) != 0 => frame.Proxy,
|
||||
|
||||
Reference in new issue
Block a user