Skip to content

Conversation

@webstreamr
Copy link
Contributor

@webstreamr webstreamr commented Dec 29, 2025

Closes #580

Simplest way of dealing with that, check proposed solutions there for possible alternatives.

Summary by CodeRabbit

  • Bug Fixes
    • Modified stream caching behaviour for library addons to improve performance and resource management. Stream caching is now disabled for library addons, whilst remaining active for standard addons.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 29, 2025

Walkthrough

The cache selection logic in the getStreams function now requires library addons to be excluded from stream caching. Previously, caching decisions relied solely on the STREAM_CACHE_TTL environment variable. Now, an additional condition ensures library addons never use the cache, regardless of TTL configuration.

Changes

Cohort / File(s) Summary
Stream cache filtering logic
packages/core/src/wrapper.ts
Added conditional check to exclude library addons from stream caching by combining Env.STREAM_CACHE_TTL != -1 with !this.addon.library requirement in getStreams function

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Poem

🐰✨ A library addon caches no more,
Fresh streams flow in through the door,
No stale data, no delayed sight,
ManualThru Store shines bright! 🌟

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarises the main change: disabling stream cache for library add-ons, matching the code modification in wrapper.ts.
Linked Issues check ✅ Passed The pull request implements the exact solution favoured in issue #580: disabling stream cache for add-ons where library: true is set.
Out of Scope Changes check ✅ Passed All changes in wrapper.ts are directly related to implementing the requested feature of disabling stream cache for library add-ons; no extraneous modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/core/src/wrapper.ts (2)

243-254: Minor inconsistency: cache invalidation for non-cached streams.

The invalidation logic always attempts to delete from streamsCache, even for library addons where caching is disabled (line 216). Whilst functionally safe, this creates a small inefficiency.

Consider conditionally invalidating only when caching was actually used, though the current approach is acceptable.


216-216: Verified: addon.library property exists and is correctly typed as boolean | undefined.

The property is defined in AddonSchema (packages/core/src/db/schemas.ts line 137) as library: z.boolean().optional(). The logic correctly handles all three states: when true (disables cache), when false (enables cache), and when undefined (treats as non-library, enabling cache by default). This is the intended behaviour since the property is optional and most addons are not library addons.

Consider adding a brief inline comment explaining why library addons bypass the cache, as this helps future maintainers understand the business logic.

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 689b8a2 and 226b901.

📒 Files selected for processing (1)
  • packages/core/src/wrapper.ts

@webstreamr
Copy link
Contributor Author

webstreamr commented Dec 29, 2025

Ah, I just had another idea: introduce an env var for library stream TTL which is also -1 by default. WDYT?

@webstreamr
Copy link
Contributor Author

@Viren070 sorry for the ping but what do you think of this

Ah, I just had another idea: introduce an env var for library stream TTL which is also -1 by default. WDYT?

was thinking of just adding another env var e.g. LIBRARY_STREAM_CACHE_TTL or STREAM_LIBRARY_CACHE_TTL next to the already existing STREAM_CACHE_TTL. feels less drastic than the change here, but basically nobody benefits from it then :D what about the change here, or does it not make sense?

@Viren070
Copy link
Owner

Viren070 commented Jan 9, 2026

I'm not really fond of adding an env var specifically to control cache for library addons - I would prefer to have a much more customisable environment variable that allows you to control cache_ttls for any addon, perhaps using hostnames which would satisfy this use case as well as many others.

@webstreamr
Copy link
Contributor Author

I'm not really fond of adding an env var specifically to control cache for library addons - I would prefer to have a much more customisable environment variable that allows you to control cache_ttls for any addon, perhaps using hostnames which would satisfy this use case as well as many others.

interesting idea. the only problematic thing for exactly my use case would be to differentiate st torz from st store I guess 🙈

@Viren070
Copy link
Owner

Viren070 commented Jan 9, 2026

Ah right, i guess we could also allow specifying preset ids.

so e.g. the value of this supposed environment variable could be:

aiometadata.domain.com:-1,stremthruStore:-1

Although I guess if theres another host which serves multiple addons and neither are available in the marketplace this variable wouldn't work for them, still I think this would work for everyone and still keep the variable simple.

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.

feature request: disable stream cache for library add-ons

2 participants