Skip to content

v0.36.0 — gh-pulse throttles the hour

Choose a tag to compare

@ralyodio ralyodio released this 13 Sep 06:58
9841e56

gh-pulse now behaves on the hour. GitHub allows 5,000 calls an hour per user, shared by gh and everything else on the token, and a few range scans in a row used to empty it, crash the next run with a 403 and keep draining the queue in the background.

  • GH_PULSE_RESERVE calls of the hour (default 500) are never spent. Down to the reserve, or rate limited anyway, a scan pauses until the hour resets and carries on, on one shared pause for every in-flight request. The pause is announced on the spinner line.
  • Four requests in flight, 100ms between starts, retry-after honoured.
  • Replies are cached by ETag under <data>/cache; an unchanged page is a free 304. since= is asked from the top of the hour so a rescan hits the cache. Measured on one repo: a cold scan charged 20 calls, the warm rescan 0.
  • A failed task aborts the queue, and gh-pulse show ends the process when the screen closes, so nothing spends the hour in the background.
  • One daily run at a time, through <data>/run.lock.
  • Each scan logs what the hour has left (from real reply headers; /rate_limit reported a fresh hour while real replies said otherwise) and closes with what was charged, what came from cache and what is left.

PR #72.