mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-06 02:16:08 +08:00
fix(queue-worker): manually renew lock (testing)
This commit is contained in:
parent
8216266d16
commit
7bb922071c
@ -94,7 +94,7 @@ export class WebScraperDataProvider {
|
||||
const jobStatus = await job.getState();
|
||||
if (jobStatus === "failed") {
|
||||
Logger.info(
|
||||
"Job has failed or has been cancelled by the user. Stopping the job..."
|
||||
"Job " + job.id + " has failed or has been cancelled by the user. Stopping the job..."
|
||||
);
|
||||
return [] as Document[];
|
||||
}
|
||||
|
@ -22,6 +22,11 @@ const wsq = getWebScraperQueue();
|
||||
async function processJob(job: Job, done) {
|
||||
Logger.debug(`🐂 Worker taking job ${job.id}`);
|
||||
|
||||
const lockInterval = setInterval(() => {
|
||||
Logger.debug(`🐂 Renewing lock for ${job.id}`);
|
||||
job.extendLock(60000);
|
||||
}, 15000);
|
||||
|
||||
try {
|
||||
job.progress({
|
||||
current: 1,
|
||||
@ -62,6 +67,7 @@ async function processJob(job: Job, done) {
|
||||
origin: job.data.origin,
|
||||
});
|
||||
Logger.debug(`🐂 Job done ${job.id}`);
|
||||
clearInterval(lockInterval);
|
||||
done(null, data);
|
||||
} catch (error) {
|
||||
Logger.error(`🐂 Job errored ${job.id} - ${error}`);
|
||||
@ -108,8 +114,9 @@ async function processJob(job: Job, done) {
|
||||
pageOptions: job.data.pageOptions,
|
||||
origin: job.data.origin,
|
||||
});
|
||||
clearInterval(lockInterval);
|
||||
done(null, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wsq.process(
|
||||
|
Loading…
x
Reference in New Issue
Block a user