Commit f671ad5
authored
fix(http): raise the CFBD retry budget so a throttle stops looking like no data (#148)
cfbfastR_cfb_pbp published nothing from 2026-07-01 onward and has no
play_by_play_2026 asset, while the cfbfastR-data job that builds it reported
success every run. In one run cfbd_play_stats_player() hit HTTP 429 sixty-three
times, so sack_player_id never materialised and the roster join in week.R:349
aborted the script 628 lines before the release upload.
httr2 was already doing the right things -- retry_is_transient() retries 429/503
by default and retry_after() honours a Retry-After header, falling back to our
backoff. Only the budget was wrong: 3 tries and roughly 1-9s of backoff covers
an incidental 429, not the sustained throttling a parallel caller produces.
When the budget ran out, req_error(is_error = ~FALSE) handed the still-429
response back and check_status() raised "The CFBD API returned HTTP 429", which
every cfbd_*() tryCatch reports as "... or no data available" -- a throttle
became indistinguishable from an empty result.
max_tries 3 -> 6 with max_seconds = 120. The cap matters: without it a hard-down
API hangs a caller for the full tries * backoff product. All 28 callers of
get_req() inherit this.
Also splits build_req() out of get_req() so the policy is assertable without
network. Signature unchanged, so tests/testthat/setup-cfbd-throttle.R still
works -- which is also why the test targets build_req() and why nothing asserts
the delegation: the throttle hot-swaps get_req() in the namespace for the whole
session.
build_req() is title-free in roxygen so no .Rd is generated for an internal
helper. No other generated file is touched: the committed docs predate the local
roxygen and regenerating rewrites ~150 unrelated man/*.Rd plus a hand-formatted
NAMESPACE.
Verified: 6/6 assertions pass offline, the same assertions fail against the old
3-try/no-max-wait policy, and R CMD check passes on ubuntu release, ubuntu
oldrel-1 and windows.
Follow-up: CLAUDE.md line 133 still says wrappers "don't hot-retry"; that is now
stale and needs updating.1 parent 14e5900 commit f671ad5
2 files changed
Lines changed: 73 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
250 | 255 | | |
251 | 256 | | |
252 | | - | |
| 257 | + | |
253 | 258 | | |
254 | 259 | | |
255 | 260 | | |
| |||
280 | 285 | | |
281 | 286 | | |
282 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
283 | 307 | | |
284 | 308 | | |
285 | | - | |
286 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
287 | 312 | | |
288 | | - | |
289 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
290 | 319 | | |
291 | 320 | | |
292 | 321 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments