mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-05-11 09:36:20 +02:00
* fix(sentry): add noise filters for 5 non-actionable error patterns Filter dynamic import alt phrasing, script parse errors, maplibre style/WebGL crashes, and CustomEvent promise rejections. Also fix beforeSend to catch short Firefox null messages like "E is null". * fix: cache write race, settings stale key status, yahoo gate concurrency P1: Replace async background thread cache write with synchronous fs::write to prevent out-of-order writes and dirty flag cleared before persistence. P2: Add WorldMonitorTab.refresh() called after loadDesktopSecrets() so the API key badge reflects actual keychain state. P3: Replace timestamp-based Yahoo gate with promise queue to ensure sequential execution under concurrent callers. * feat: add Upstash Redis shared caching to all RPC handlers + fix cache key contamination - Add Redis L2 cache (getCachedJson/setCachedJson) to 28 RPC handlers across all service domains (market, conflict, cyber, economic, etc.) - Fix 10 P1 cache key contamination bugs where under-specified keys caused cross-request data pollution (e.g. filtered requests returning unfiltered cached data) - Restructure list-internet-outages to cache-then-filter pattern so country/timeRange filters always apply after cache read - Add write_lock mutex to PersistentCache in main.rs to prevent desktop cache write-race conditions - Document FMP (Financial Modeling Prep) as Yahoo Finance fallback TODO in market/v1/_shared.ts * fix: cache-key contamination and PizzINT/GDELT partial-failure regression - tech-events: fetch with limit=0 and cache full result, apply limit slice after cache read to prevent low-limit requests poisoning cache - pizzint: restore try-catch around PizzINT fetch so GDELT tension pairs are still returned when PizzINT API is down * fix: remove extra closing brace in pizzint try-catch * fix: recompute conferenceCount/mappableCount after limit slice * fix: bypass WM API key gate for registration endpoint /api/register-interest must reach cloud without a WorldMonitor API key, otherwise desktop users can never register (circular dependency).
22 lines
789 B
TypeScript
22 lines
789 B
TypeScript
export const CHROME_UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36';
|
|
|
|
/**
|
|
* Global Yahoo Finance request gate.
|
|
* Ensures minimum spacing between ANY Yahoo requests across all handlers.
|
|
* Multiple handlers calling Yahoo concurrently causes IP-level rate limiting (429).
|
|
*/
|
|
let yahooLastRequest = 0;
|
|
const YAHOO_MIN_GAP_MS = 600;
|
|
let yahooQueue: Promise<void> = Promise.resolve();
|
|
|
|
export function yahooGate(): Promise<void> {
|
|
yahooQueue = yahooQueue.then(async () => {
|
|
const elapsed = Date.now() - yahooLastRequest;
|
|
if (elapsed < YAHOO_MIN_GAP_MS) {
|
|
await new Promise<void>(r => setTimeout(r, YAHOO_MIN_GAP_MS - elapsed));
|
|
}
|
|
yahooLastRequest = Date.now();
|
|
});
|
|
return yahooQueue;
|
|
}
|