fix: populate short interest cache directly instead of relying on clogged drain queue
The stale-while-revalidate pattern queues background fetches via the AdapterQueue, but with 227+ pending jobs, short interest keys take too long to process. Users saw empty panels on every symbol because the fetch never completed before the response returned. Fix: - shortInterest procedure: when Yahoo + NASDAQ caches are both empty, fetch directly via the adapters, store in cache, and return — all within the request. Subsequent requests hit the cache. Bypasses the clogged queue entirely. - FinraBulkAdapter: guard against per-symbol keys (non-'latest' and non-date IDs) by returning a skipped result instead of trying to download a file named after the ticker. - finraShortInterest handler: return isStale=false when no data is in the table, so per-symbol reads never trigger queue fetches (FINRA is schedule-only). Router stale computation now excludes FINRA from the combined stale flag.
This commit is contained in:
+4
-1
@@ -340,7 +340,10 @@ const finraShortInterestHandler: KindHandler = {
|
||||
write(_d, _symbol, _value, _provenance) {
|
||||
// FINRA data is bulk-ingested via FinraIngestService; no per-symbol write needed.
|
||||
},
|
||||
isStale(ts, now) { return tsAgeMs(ts, now) > TTL_MS.short_interest; },
|
||||
isStale(ts, now) {
|
||||
if (ts === null) return false; // schedule-only; never queue per-symbol fetches
|
||||
return tsAgeMs(ts, now) > TTL_MS.short_interest;
|
||||
},
|
||||
};
|
||||
|
||||
const HANDLERS = new Map<string, KindHandler>([
|
||||
|
||||
Reference in New Issue
Block a user