Skip to content

Retry a failed image fetch instead of giving up for the session - #18

Merged
ShaalaXIV merged 1 commit into
mainfrom
claude/retry-image-fetch
Sep 26, 2026
Merged

ShaalaXIV merged 1 commit into
mainfrom
claude/retry-image-fetch

Conversation

@ShaalaXIV

Copy link
Copy Markdown
Owner

A portrait that would not stay put between game restarts was never a saving problem. The picture was on the server the whole time.

ImageCache set Failed on the first unsuccessful fetch and never cleared it:

if (entries.TryGetValue(key, out var existing))
{
    existing.LastTouched = DateTime.UtcNow;
    return existing.Texture;   // null for ever, once failed
}

So an image that failed once was dead until the plugin reloaded. The commonest cause is the card being drawn before the plugin has finished connecting, or a blink of network at login — half a second of bad luck turning into a picture that never appears again that session. Restarting the game built a fresh cache, which is exactly why it looked like the photo failed to persist and then came back.

Changes

  • Failed fetches retry with backoff: 2, 4, 8, 16, 32, then 60 seconds. A success resets the count.
  • OperationCanceledException during unload is no longer recorded as a failure — it poisoned an entry for a cache about to be discarded.
  • A Loading flag prevents a retry starting a second concurrent fetch.
  • The frame stops lying: it said "Loading..." whether a fetch was in flight or had given up. After three failures it now says "Picture unavailable". Both new labels are covered by the contrast audit.

🤖 Generated with Claude Code

A portrait that would not stay put between restarts was never a saving problem.
The picture was on the server the whole time.

ImageCache set Failed on the first unsuccessful fetch and never cleared it, so
an image that failed once was dead until the plugin reloaded. The commonest
cause is the card being drawn before the plugin has finished connecting, or a
blink of network at login -- half a second of bad luck turning into a picture
that never appears again that session. Restarting the game built a new cache,
which is why it looked like the photo failed to persist and then came back.

Fetches now retry with a backoff of 2, 4, 8, 16, 32 then 60 seconds, and a
success clears the count. Cancellation during unload is no longer recorded as a
failure, since it poisons an entry for a cache that is about to be discarded.

The frame also stops lying. It said "Loading..." whether a fetch was in flight
or had given up entirely, which is worse than an empty frame because the reader
cannot act on it. After three failures it says "Picture unavailable".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ShaalaXIV
ShaalaXIV merged commit d6c1ff0 into main Sep 26, 2026
1 check passed
@ShaalaXIV
ShaalaXIV deleted the claude/retry-image-fetch branch September 26, 2026 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant