perf: 订阅 serve 缓存改为内容寻址(失效驱动,不再按 TTL 重跑引擎) - #34
Merged
Conversation
A rendered body used to live for 300s and then be re-rendered no matter what — every re-render boots the plugin's JavaScript engine, measured at 13.5s on production for a script-built file, so any client polling slower than the TTL paid that on every single poll. The TTL is now a revalidation cadence (30m, aligned with the snapshot refresh interval), not a lifetime. On expiry the serve path refreshes the snapshot — cheap, no engine — and compares content digests: unchanged extends the cached body, changed re-renders once. A source that cannot be reached serves the last good body instead of an error, mirroring the snapshot layer's keep-the-client's-config rule one step down. Invalidation is event-driven where the TTL could not see change: a refresh that returns different bytes drops the shares sourcing that record, and a successful save/delete/import/migrate through the plugin's management API drops the shares sourcing that plugin's store — an edit changes what a record renders without changing any content hash.
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.
问题(生产实测)
渲染缓存 300s 过期即重渲染;重渲染=冷启动插件 JS 引擎,脚本文件实测 13.5s、组合 12.6s。任何轮询间隔超过 5 分钟的客户端,每次拉取都付全价。
改动
配套插件 PR #17:fetch 覆盖全部记录种类,组合/文件从此可分享,且渲染端消费快照后稳态 serve 只需 1-2 次 host 调用。
Test plan