Fix maxRetries not defined crash in handleResult

The stuck/incomplete retry logic referenced maxRetries which was only
defined in main() scope, not in handleResult(). Compute it locally.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 15:11:32 -08:00
parent 3bf1786895
commit 7bd91a19a0

View File

@@ -337,8 +337,9 @@ async function handleResult(job, result, results, settings, profile, apiKey) {
case 'stuck':
case 'incomplete': {
const retries = (job.retry_count || 0) + 1;
if (retries <= maxRetries) {
console.log(` ⏭️ ${status} — will retry (attempt ${retries}/${maxRetries})`);
const maxRetry = settings.max_retries ?? DEFAULT_MAX_RETRIES;
if (retries <= maxRetry) {
console.log(` ⏭️ ${status} — will retry (attempt ${retries}/${maxRetry})`);
updateJobStatus(job.id, 'new', { title, company, retry_count: retries });
} else {
console.log(` ⏭️ ${status} — max retries reached`);