write negative cache ONLY on permanent provider failure so transient errors retry
All checks were successful
Generic zig build / build (push) Successful in 6m16s
Generic zig build / publish-macos (push) Successful in 21s
Generic zig build / deploy (push) Successful in 27s

This commit is contained in:
Emil Lerch 2026-06-30 16:52:33 -07:00
parent 9699bed480
commit d15e4d024a
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -1003,11 +1003,16 @@ pub const DataService = struct {
} }
return DataError.TransientError; return DataError.TransientError;
} }
// NotFound, ParseError, InvalidResponse, AuthError - // Only a genuine NotFound means "this symbol has no candle
// symbol genuinely has no candle data on Tiingo (the only // data on Tiingo" (the sole historical-candle provider since
// provider for historical candles since the 2026-05 // the 2026-05 audit) and earns a sticky negative-cache entry.
// audit). Negative-cache so we don't keep retrying. // Unauthorized / InvalidResponse / PaymentRequired and the
s.writeNegative(symbol, .candles_daily); // like are not permanent facts about the symbol (transient
// auth misconfig, a malformed response) - fail this call but
// stay retryable, matching fetchCached's policy. This matters
// now that the candle negative cache is actually honored: a
// bad negative would otherwise stick until --refresh.
if (isPermanentProviderFailure(err)) s.writeNegative(symbol, .candles_daily);
return DataError.FetchFailed; return DataError.FetchFailed;
}; };
// populateAllFromTiingo writes all three caches itself; we // populateAllFromTiingo writes all three caches itself; we