feat(cache): add per-breaker persistent stale ceiling#1664
feat(cache): add per-breaker persistent stale ceiling#1664aashirpersonal wants to merge 1 commit intokoala73:mainfrom
Conversation
Add optional `persistentStaleCeilingMs` to `CircuitBreakerOptions` so individual breakers can override the global 24 h `PERSISTENT_STALE_CEILING_MS` constant. Risk scores breaker now uses a 1 h ceiling since day-old CII data is unacceptable for a conflict monitoring app. Closes koala73#1326
|
@aashirpersonal is attempting to deploy a commit to the Elie Team on Vercel. A member of the Team first needs to authorize it. |
|
You're right on the premise, @aashirpersonal all the magic numbers will be part of what differs between FREE and PRO users, I was paying a lot per day in hosting because I had very tight 1 to 5min refresh cycles. |
|
Thanks for the context @koala73! That makes sense — having per-breaker control is exactly what you'd need to differentiate refresh cycles between tiers. This PR keeps it simple: just the optional override with the global 24h as default, so no existing behavior changes. Should slot in nicely as the foundation for tier-based config later. Happy to adjust anything if needed. |
Summary
Adds an optional
persistentStaleCeilingMsparameter toCircuitBreakerOptionsso individual breakers can override the global 24 hPERSISTENT_STALE_CEILING_MSconstant.Risk scores breaker now uses a 1 h ceiling — day-old CII data is unacceptable for a conflict monitoring app.
Closes #1326
Changes
src/utils/circuit-breaker.tspersistentStaleCeilingMs?toCircuitBreakerOptionsinterfacehydratePersistentCache()src/services/cached-risk-scores.tspersistentStaleCeilingMs: 60 * 60 * 1000(1 h)Backward compatible
All existing breakers continue using the 24 h default — only breakers that explicitly set
persistentStaleCeilingMsare affected.