diff --git a/.gitignore b/.gitignore index db3f8c9..0c304b4 100755 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,10 @@ Thumbs.db !.env.example !.env.test +# Home worker credentials and browser cookies +/house.env +/.house-worker-profile/ + # Vite vite.config.js.timestamp-* vite.config.ts.timestamp-* diff --git a/scripts/house-worker.ts b/scripts/house-worker.ts index d83ca85..16f679b 100644 --- a/scripts/house-worker.ts +++ b/scripts/house-worker.ts @@ -58,7 +58,7 @@ const config = { ), slowEveryHours: number(process.env.HOUSE_SLOW_EVERY_HOURS, 12), slowMaxPages: number(process.env.HOUSE_SLOW_MAX_PAGES, 80), - minGapMs: number(process.env.HOUSE_MIN_GAP_SECONDS, 8) * 1000, + minGapMs: Math.max(8, number(process.env.HOUSE_MIN_GAP_SECONDS, 8)) * 1000, dailyBudget: number(process.env.HOUSE_DAILY_BUDGET, 1500), fetchMode: (process.env.HOUSE_FETCH_MODE ?? 'fetch') as 'fetch' | 'browser', userAgent: @@ -115,7 +115,7 @@ function slowBudgetLeft() { async function waitForTurn() { resetBudget(); if (budgetUsed >= config.dailyBudget) throw new Error('Daily request budget used up'); - const gap = config.minGapMs * (0.8 + Math.random() * 0.7); + const gap = config.minGapMs * (1 + Math.random() * 0.5); const wait = lastRequestAt + gap - Date.now(); if (wait > 0) await sleep(wait); lastRequestAt = Date.now();