Merge pull request 'Backfill BFS derinligini 5->2'ye indir (sig pre-warm)' (#143) from dev into main
This commit was merged in pull request #143.
This commit is contained in:
@@ -26,7 +26,18 @@ import {
|
||||
import { PrefetchCategoryJobData, PrefetchInitJobData } from "./prefetch.types";
|
||||
import { CATALOG_PREFETCH_QUEUE } from "./queues/catalog-prefetch.queue";
|
||||
|
||||
const MAX_DEPTH = 5;
|
||||
/**
|
||||
* How deep the background prefetch BFS drills the category tree.
|
||||
*
|
||||
* Kept SHALLOW (2) on purpose: pre-warming the top ~2 levels for every decoded
|
||||
* vehicle is bounded work that finishes in days, kills empty catalog pages, and
|
||||
* makes the first clicks instant. Deeper categories are fetched lazily on-view
|
||||
* (getCategoryTree in CategoriesService) and cached permanently — so the long
|
||||
* tail nobody opens never costs an upstream request. Exhaustive depth-5
|
||||
* pre-warm produced an unbounded BFS fan-out (~460k jobs) that never drained
|
||||
* and starved the useful shallow + reactive work. Env-tunable.
|
||||
*/
|
||||
const MAX_DEPTH = Number(process.env.PREFETCH_MAX_DEPTH) || 2;
|
||||
|
||||
// ── Backfill scan (hourly cron) tuning ──
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user