Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
fix: move to completed in one place
Gergo Moricz191dfbd9caf0
diff --git a/apps/api/src/main/runWebScraper.ts b/apps/api/src/main/runWebScraper.tsindex 166deaf9b..9c41073a1 100644--- a/apps/api/src/main/runWebScraper.ts+++ b/apps/api/src/main/runWebScraper.ts@@ -141,21 +141,21 @@ const saveJob = async (job: Job, result: any, token: string, mode: string) => {.eq("job_id", job.id);if (error) throw new Error(error.message);- try {- if (mode === "crawl") {- await job.moveToCompleted(null, token, false);- } else {- await job.moveToCompleted(result, token, false);- }- } catch (error) {- // I think the job won't exist here anymore- }- } else {- try {- await job.moveToCompleted(result, token, false);- } catch (error) {- // I think the job won't exist here anymore- }+ // try {+ // if (mode === "crawl") {+ // await job.moveToCompleted(null, token, false);+ // } else {+ // await job.moveToCompleted(result, token, false);+ // }+ // } catch (error) {+ // // I think the job won't exist here anymore+ // }+ // } else {+ // try {+ // await job.moveToCompleted(result, token, false);+ // } catch (error) {+ // // I think the job won't exist here anymore+ // }}ScrapeEvents.logJobEvent(job, "completed");} catch (error) {diff --git a/apps/api/src/services/queue-worker.ts b/apps/api/src/services/queue-worker.tsindex d1372e2c8..49137d39a 100644--- a/apps/api/src/services/queue-worker.ts+++ b/apps/api/src/services/queue-worker.ts@@ -51,7 +51,7 @@ const processJobInternal = async (token: string, job: Job) => {try {const result = await processJob(job, token);const jobState = await job.getState();- if(jobState !== "completed" && jobState !== "failed"){+ if (jobState !== "completed" && jobState !== "failed") {try{await job.moveToCompleted(result.docs, token, false); //3rd arg fetchNext}catch(e){