Add declarative refetch intervals to HTTP queries
- 主要语言
- Rust
- 星标
- 9
- 派生
- 1
- 平均合并
- 11 小时 46 分钟
- 30 天内合并 PR
- 62
描述
## Summary
Add an opt-in declarative refetch interval for active HTTP queries.
Applications can build this today by combining `Timer` with `QueryClient::invalidate()`. A query-level option would remove boilerplate and make periodic refresh behavior consistent across applications. This is separate from subscription restart rate control: it schedules a successful query's next invalidation rather than rate-limiting re-admission of a finished source.
## Design requirements
- The default remains no periodic refetch.
- Periodic work exists only while the query is active; inactive retained data must not keep an unowned task alive.
- Multiple subscribers to the same query cell must not create duplicate interval tasks or duplicate fetches.
- An interval firing during an in-flight fetch must follow the existing generation/coalescing rules.
- Error behavior must not create an implicit tight retry loop.
- Tests use paused Tokio time.
## Acceptance criteria
- [ ] `QueryConfig` or an equivalent query-owned surface can opt into periodic refetch.
- [ ] Active/inactive lifecycle and retention behavior are documented.
- [ ] Shared cells run at most one periodic schedule and one fetch for a generation.
- [ ] Paused-time tests cover activation, deactivation, in-flight overlap, errors, and multiple subscribers.
- [ ] Existing `Timer` plus `invalidate()` composition remains valid.
贡献指南
调研方向
Start by locating QueryConfig, QueryClient::invalidate(), Timer, and the query-cell active/inactive lifecycle, then inspect existing tests that use paused Tokio time. Trace how shared cells coalesce generations and fetches before defining the query-owned schedule. Done means the acceptance criteria pass, including lifecycle, overlap, error, subscriber, and retention behavior, while existing Timer-plus-invalidate composition still works.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- rust
- 领域
- backend-api-design, networking
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100