akiomik / akiomik/tears

Add declarative refetch intervals to HTTP queries

Offen
#328 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Rust
Sterne
9
Forks
1
Ø Merge
11 Std. 46 Min.
Gemergte PRs (30 T.)
62

Beschreibung

## 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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.