4 ms·
Yep, I've been bitten by exactly this failure mode. You have to invalidate/bust the cache when a failure is returned (which is racy, but since cache busting is
by zbentley 4y ago
Yep, I've been bitten by exactly this failure mode.
You have to invalidate/bust the cache when a failure is returned (which is racy, but since cache busting is on the sad path it's a fine place to protect with a plain ol' mutex, assuming you even have real parallelism/preemption in the mix).
Alternatively you can cache promises to functions that will never return failure and will instead internally retry until they succeed. This approach generalizes less well to arbitrary promises, but is more friendly to implementing the custom back off/retry scheme of your choice.