feat: flush jobs to queue per-page — no data loss on crash; live progress output

This commit is contained in:
2026-03-06 00:17:33 +00:00
parent 234820ad91
commit f9fa36b47c
4 changed files with 29 additions and 12 deletions

View File

@@ -19,7 +19,7 @@ export async function verifyLogin(page) {
return page.url().includes('/feed');
}
export async function searchLinkedIn(page, search) {
export async function searchLinkedIn(page, search, { onPage } = {}) {
const jobs = [];
for (const keyword of search.keywords) {
@@ -69,6 +69,7 @@ export async function searchLinkedIn(page, search) {
}, { track: search.track, excludes: search.exclude_keywords || [] });
jobs.push(...found);
if (found.length > 0 && onPage) onPage(found);
// Click next page button
const nextBtn = await page.$('button[aria-label="View next page"]');

View File

@@ -18,7 +18,7 @@ export async function verifyLogin(page) {
return loggedIn;
}
export async function searchWellfound(page, search) {
export async function searchWellfound(page, search, { onPage } = {}) {
const jobs = [];
for (const keyword of search.keywords) {
@@ -77,6 +77,7 @@ export async function searchWellfound(page, search) {
}, { track: search.track, excludes: search.exclude_keywords || [], maxResults: SEARCH_RESULTS_MAX });
jobs.push(...found);
if (found.length > 0 && onPage) onPage(found);
}
// Dedupe by URL