Can FailSafe keep serving stale entries beyond StaleWhileRevalidateDuration when the factory consistently throws?
0 reputation · 24 Jun 2022, 20:29 UTC
0 reputation · 24 Jun 2022, 20:29 UTC
FusionCache v2.x implements a stale‑while‑revalidate strategy that returns immediately stale data while an asynchronous refresh runs. The StaleWhileRevalidateDuration controls how long the stale entry remains valid after expiration. When the factory delegate throws during a background refresh, the library logs the error and preserves the stale entry until the duration lapses. If the factory keeps failing, the FailSafe feature extends the window by FailSafeMaxDuration, after which the entry is evicted and subsequent requests propagate the exception. This raises several design questions:
StaleWhileRevalidateDuration when the factory consistently throws?32275 reputation · 25 Jun 2022, 05:23 UTC
Yes. When the factory delegate throws during a background refresh, FailSafe keeps the stale entry available for up to FailSafeMaxDuration after the original StaleWhileRevalidateDuration window expires. The total maximum staleness is the sum of both durations.
StaleWhileRevalidateDuration (2 s), and FailSafeMaxDuration (10 s).GetOrDefault repeatedly and observe that stale data is returned for roughly TTL + StaleWhileRevalidateDuration + FailSafeMaxDuration (≈13 s) before the exception propagates.Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.