Skip to content

fix(cache): add a picture to the cache without downloading it - #571

Open
Oaradla wants to merge 1 commit into
toniebox-reverse-engineering:developfrom
Oaradla:fix/cache-add-no-download
Open

Oaradla wants to merge 1 commit into
toniebox-reverse-engineering:developfrom
Oaradla:fix/cache-add-no-download

Conversation

@Oaradla

@Oaradla Oaradla commented Oct 30, 2026

Copy link
Copy Markdown

Since #527 (e57fa45), cache_add() looks up an existing entry with cache_fetch_by_url(), which also downloads the
picture when it is not cached yet. With tonie_json.cache_images on, loading tonies.json thus downloads pictures one
after the other even with tonie_json.cache_preload off, and /api/toniesJsonReload hangs for minutes with a fresh
cache.

The lookup now uses a separate cache_find_by_url() without the download; cache_fetch_by_url() keeps its behaviour
and uses it. The duplicate-entry leak fixed by #527 stays fixed.

Tested: make build, make test_py TESTS=cache, make test_py TESTS=Cache499.

Fixes #570

cache_add() looks up an existing entry with cache_fetch_by_url(), which
also downloads the file (toniebox-reverse-engineering#527). With tonie_json.cache_images on, every
load of tonies.json (start, /api/toniesJsonReload) therefore downloads
all pictures one by one, and the reload request hangs for many minutes.
Look the entry up without fetching it.
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