stremio-jellyfin: say how long a stream answer may be cached - #124
Merged
Merged
Conversation
The addon sent no cacheMaxAge, so the Stremio client applied its own default -- and a cached answer outlived the fix that corrected it. Measured 2026-09-22: the refusal shipped at 14:00, and the same client was still playing the old fallback at 23:00 for the episodes it had cached. The same default would hide an episode the drain has just delivered. 300 seconds, not 0: every request makes this addon scan the whole Jellyfin library, so answering every navigation from scratch costs a full scan per episode opened. Five minutes caps staleness while absorbing a burst of re-opens.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The addon sent no
cacheMaxAge, so the Stremio client applied its own default — and a cached answer outlived the fix that corrected it.Measured 2026-09-22: the exact-match refusal shipped at 14:00, and the same client was still playing the old fallback at 23:00 for the episodes it had cached. The client asked the addon again at 22:56, received an empty stream list, and still offered a Jellyfin stream from its cache. The same default hides an episode the drain has just delivered — the client keeps saying "no source" for something that arrived an hour ago.
The change
Every stream answer now carries
cacheMaxAge: 300, refusals included.300 and not 0: each request makes this addon scan the whole Jellyfin library (
getItemByImdbIdlists every Movie and Series to filter by IMDb id), so answering every navigation from scratch costs the NAS a full scan per episode opened. Five minutes caps how stale an answer can be while still absorbing a burst of re-opens.Verification
On the NAS, at this HEAD, rebuilt from this branch:
The e2e spec asserts it on both paths — the refusal (deterministic) and a resolved episode (the answer that changes when the library gains one) — so a future edit that drops the field fails rather than silently restoring the default.
One thing this cannot fix: an entry already cached by a client keeps its old lifetime until it expires. A client-side refresh is still needed once.
Not related to the drain or the arrs: this is the addon's own response header.