slow down ukvisajobs

This commit is contained in:
DaKheera47 2025-12-27 12:24:30 +00:00
parent 45662c386a
commit d24966e0eb

View File

@ -57,7 +57,8 @@ export async function runUkVisaJobs(options: RunUkVisaJobsOptions = {}): Promise
const allJobs: CreateJobInput[] = []; const allJobs: CreateJobInput[] = [];
const seenIds = new Set<string>(); const seenIds = new Set<string>();
for (const term of terms) { for (let i = 0; i < terms.length; i++) {
const term = terms[i];
const termLabel = term ? `"${term}"` : 'all jobs'; const termLabel = term ? `"${term}"` : 'all jobs';
console.log(` Running for ${termLabel}...`); console.log(` Running for ${termLabel}...`);
@ -106,6 +107,12 @@ export async function runUkVisaJobs(options: RunUkVisaJobsOptions = {}): Promise
console.error(`❌ UK Visa Jobs failed for ${termLabel}: ${message}`); console.error(`❌ UK Visa Jobs failed for ${termLabel}: ${message}`);
// Continue to next term instead of failing completely // Continue to next term instead of failing completely
} }
// Delay between terms
if (i < terms.length - 1) {
console.log(' Waiting 5s before next search term...');
await new Promise((resolve) => setTimeout(resolve, 5000));
}
} }
console.log(`✅ UK Visa Jobs: imported total ${allJobs.length} unique jobs`); console.log(`✅ UK Visa Jobs: imported total ${allJobs.length} unique jobs`);