Skip to content

feat: share each fetch for 10 seconds between the prtops running at once - #17

Merged
TomyCesaille merged 2 commits into
mainfrom
watch-reuses-live-fetch
Oct 28, 2026
Merged

TomyCesaille merged 2 commits into
mainfrom
watch-reuses-live-fetch

Conversation

@TomyCesaille

@TomyCesaille TomyCesaille commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #16.

Shared fetch (fetch_report in prtop/cli.py, prtop/state.py): every fetch saves its report to report.json in the state directory. That covers the live view, a one-shot table and prtop watch. The save carries the settings the fetch ran under (repr(config)) and the time it came back. A prtop about to fetch less than 10 seconds later (FRESH_FOR), under the same settings, shows that report instead of calling glab or gh.

  • The window is fixed rather than tied to the watch's -d, as the issue proposed. The lag stays under 10 s whatever the loops' delays, and a closed or paused live view never leaves a watch reading an old table.
  • Beside the live view, which fetches every 30 s, about one watch check in three falls in the window and makes no calls. Two one-shot tables or two watches seconds apart share one fetch.
  • A reused report never moves the merge-detection baseline in <host>.json. Only the fetch that called the forges does.
  • The live view honours the same window: Ctrl+L within 10 s of the last fetch, or -d under 10, shows that fetch again.
  • A save dated in the future (the clock moved back), a missing one and a malformed one all read as no save. --demo neither reads nor saves.
  • examples/claude-code/CLAUDE.md drops the advice to skip the watch while prtop is open.

Tried with a fake glab and gh that log every call: a second prtop right after the first logged 0 calls, and a third 10.5 s later fetched again.

@TomyCesaille TomyCesaille self-assigned this Oct 27, 2026
@TomyCesaille TomyCesaille changed the title feat: let prtop watch read the live view's latest fetch instead of fetching again feat: share each fetch for 10 seconds between the prtops running at once Oct 27, 2026
@TomyCesaille
TomyCesaille marked this pull request as ready for review October 28, 2026 08:03
@TomyCesaille
TomyCesaille merged commit 669baf6 into main Oct 28, 2026
9 checks passed
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.

Watch: reuse a fresh fetch from the live view instead of fetching again

1 participant