Skip to content

tonie_json.cache_images downloads pictures while tonies.json loads, although cache_preload is off #570

Open

Description

@Oaradla

Describe the bug
With tonie_json.cache_images on and tonie_json.cache_preload off, pictures should only be downloaded when they are
first requested. Since #527 (e57fa45), cache_add() checks for an existing entry with cache_fetch_by_url(), which
also downloads the picture when its file is not in the cache yet. Loading tonies.json therefore downloads pictures one
after the other:

  • at start, every picture whose URL tonies.json repeats,
  • at every reload (/api/toniesJsonReload, the automatic tonies.json update), every picture that is not cached yet,
    i.e. with a fresh cache all of them.

The reload request then does not answer for many minutes, and cache_preload = false has no effect.

To Reproduce

  1. Empty cache folder, tonie_json.cache_images = true, tonie_json.cache_preload = false
  2. Start teddyCloud, then call /api/toniesJsonReload
  3. The request hangs; the cache folder fills with one picture after the other

Expected behavior
Adding a picture to the cache only creates its entry, as in 0.7.0. Pictures are downloaded during the load only with
tonie_json.cache_preload.

Technical Details:

  • Version: develop (907acea); 0.7.0 is not affected

Additional context
A fix follows as PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions