feat(prefetch): PL24 scrape penceresini varsayılan olarak devre dışı bırak (7/24 akış)
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled
PL24 prefetch artık 09:00-18:00 İstanbul penceresine bağlı değil; backfill backlog'unun ~%96.7'si PL24 children olduğundan 9 saatlik pencere drenajı boğuyordu. Pencere env ile geri daraltılabilir (PREFETCH_PL24_START/_END). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -86,21 +86,21 @@ function currentIstanbulHour(): number {
|
||||
|
||||
/**
|
||||
* Whether `source` may be scraped right now.
|
||||
* PL24 → 09:00–18:00 (Europe/Istanbul); upstream rate-limit is still
|
||||
* tighter outside that window so user-facing requests benefit from the
|
||||
* guard. EMEX, parts-catalogs, and everything else have no window
|
||||
* (always true). parts-catalogs used to be 09:00–19:00 too, but the
|
||||
* Redis-persisted warm JWT pool (commits aa4d055 + dcf7e06) now keeps
|
||||
* captures alive 24/7 so backfill can sweep through the night when the
|
||||
* upstream is most idle.
|
||||
*
|
||||
* Time windows are DISABLED by default — PL24 (and everything else) may be
|
||||
* scraped 24/7. The window is still env-tunable: set PREFETCH_PL24_START /
|
||||
* PREFETCH_PL24_END (Europe/Istanbul hours) to re-narrow it (e.g.
|
||||
* PREFETCH_PL24_START=9 PREFETCH_PL24_END=18). EMEX and parts-catalogs never
|
||||
* had a window — their Redis-persisted warm JWT pool keeps captures alive
|
||||
* through the night.
|
||||
*/
|
||||
/** PL24 scrape window (Europe/Istanbul hours), env-tunable so it can be widened
|
||||
* without a redeploy (e.g. PREFETCH_PL24_START=8 PREFETCH_PL24_END=22). */
|
||||
const PL24_WINDOW_START = Number(process.env.PREFETCH_PL24_START) || 9;
|
||||
const PL24_WINDOW_END = Number(process.env.PREFETCH_PL24_END) || 18;
|
||||
const PL24_WINDOW_START = Number(process.env.PREFETCH_PL24_START) || 0;
|
||||
const PL24_WINDOW_END = Number(process.env.PREFETCH_PL24_END) || 24;
|
||||
|
||||
export function isWithinTimeWindow(source: string): boolean {
|
||||
if (source !== "pl24") return true;
|
||||
// Default (0–24) means the window is disabled → PL24 flows 24/7.
|
||||
if (PL24_WINDOW_START <= 0 && PL24_WINDOW_END >= 24) return true;
|
||||
const h = currentIstanbulHour();
|
||||
return h >= PL24_WINDOW_START && h < PL24_WINDOW_END;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user