Commit ca88f2c
authored
fix(content-cache): force sync refresh on operator invalidation (#933)
markGitHubContentStale and markDocsArtifactsStale set staleAt to the
epoch as a "force refresh on next read" sentinel — used by the admin
invalidate button and the GitHub push webhook. The SWR readers in
getCachedGitHubContent and getCachedDocsArtifact ignored that intent:
when a row had positive cached content but was stale, they returned
the cached value and fire-and-forgot a background refresh. On Netlify
Functions the background promise often never lands, the rendered page
goes back into the CDN with stale content, and the next CDN
revalidation pulls the same stale row — invalidation effectively
never converges.
Add isForciblyStale(staleAt) that recognizes the epoch sentinel, and
route forcibly-stale rows past the SWR branch into withPendingRefresh
so the very next request awaits a fresh origin fetch. Natural TTL
expiry still SWRs as before. The stale-on-origin-error fallback at the
bottom of withPendingRefresh is preserved, so a failed GitHub call
after invalidation still returns the previously cached value instead
of erroring.1 parent 3a136f2 commit ca88f2c
1 file changed
Lines changed: 34 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
131 | 143 | | |
132 | 144 | | |
133 | 145 | | |
| |||
253 | 265 | | |
254 | 266 | | |
255 | 267 | | |
| 268 | + | |
256 | 269 | | |
257 | | - | |
| 270 | + | |
258 | 271 | | |
259 | 272 | | |
260 | 273 | | |
| |||
272 | 285 | | |
273 | 286 | | |
274 | 287 | | |
275 | | - | |
276 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
277 | 297 | | |
278 | 298 | | |
279 | 299 | | |
| |||
388 | 408 | | |
389 | 409 | | |
390 | 410 | | |
| 411 | + | |
391 | 412 | | |
392 | | - | |
| 413 | + | |
393 | 414 | | |
394 | 415 | | |
395 | 416 | | |
| |||
408 | 429 | | |
409 | 430 | | |
410 | 431 | | |
411 | | - | |
412 | | - | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
413 | 441 | | |
414 | 442 | | |
415 | 443 | | |
| |||
0 commit comments