Fix process not exiting after run, detect closed job listings
- All entry points with log tee now call logStream.end() + process.exit() (log stream kept event loop alive, blocking next cron run) - easy_apply: detect "no longer accepting applications" and similar closed listing text before reporting as unsupported Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -327,7 +327,9 @@ async function handleResult(job, result, results, settings, profile, apiKey) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch(e => {
|
main().then(() => {
|
||||||
|
logStream.end(() => process.exit(0));
|
||||||
|
}).catch(e => {
|
||||||
console.error('Fatal:', e.message);
|
console.error('Fatal:', e.message);
|
||||||
process.exit(1);
|
logStream.end(() => process.exit(1));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -299,7 +299,9 @@ async function main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch(err => {
|
main().then(() => {
|
||||||
|
logStream.end(() => process.exit(0));
|
||||||
|
}).catch(err => {
|
||||||
console.error('Fatal:', err.message);
|
console.error('Fatal:', err.message);
|
||||||
process.exit(1);
|
logStream.end(() => process.exit(1));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -248,8 +248,10 @@ async function main() {
|
|||||||
return { added: totalAdded, seen: totalSeen };
|
return { added: totalAdded, seen: totalSeen };
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch(e => {
|
main().then(() => {
|
||||||
|
logStream.end(() => process.exit(0));
|
||||||
|
}).catch(e => {
|
||||||
console.error('Fatal:', e.message);
|
console.error('Fatal:', e.message);
|
||||||
if (e.stack) console.error(e.stack);
|
if (e.stack) console.error(e.stack);
|
||||||
process.exit(1);
|
logStream.end(() => process.exit(1));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -163,6 +163,16 @@ export async function apply(page, job, formFiller) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!eaBtn) {
|
if (!eaBtn) {
|
||||||
|
// Check if the listing is closed
|
||||||
|
const closed = await page.evaluate(() => {
|
||||||
|
const text = (document.body.innerText || '').toLowerCase();
|
||||||
|
return text.includes('no longer accepting') || text.includes('no longer available') ||
|
||||||
|
text.includes('this job has expired') || text.includes('job is closed');
|
||||||
|
}).catch(() => false);
|
||||||
|
if (closed) {
|
||||||
|
console.log(` ℹ️ Job closed — no longer accepting applications`);
|
||||||
|
return { status: 'skipped_no_apply', meta };
|
||||||
|
}
|
||||||
console.log(` ℹ️ No Easy Apply button found. Page URL: ${page.url()}`);
|
console.log(` ℹ️ No Easy Apply button found. Page URL: ${page.url()}`);
|
||||||
console.log(` Action: job may have been removed, filled, or changed to external apply`);
|
console.log(` Action: job may have been removed, filled, or changed to external apply`);
|
||||||
return { status: 'skipped_easy_apply_unsupported', meta };
|
return { status: 'skipped_easy_apply_unsupported', meta };
|
||||||
|
|||||||
Reference in New Issue
Block a user