Nick: fixes

This commit is contained in:
Nicolas 2024-10-01 15:15:49 -03:00
parent 92dbd33e57
commit 8aa07afb6d
3 changed files with 3 additions and 3 deletions

View File

@ -245,7 +245,7 @@ export async function scrapeController(req: Request, res: Response) {
} }
if (creditsToBeBilled > 0) { if (creditsToBeBilled > 0) {
// billing for doc done on queue end, bill only for llm extraction // billing for doc done on queue end, bill only for llm extraction
billTeam(team_id, chunk.sub_id, creditsToBeBilled).catch(error => { billTeam(team_id, chunk?.sub_id, creditsToBeBilled).catch(error => {
Logger.error(`Failed to bill team ${team_id} for ${creditsToBeBilled} credits: ${error}`); Logger.error(`Failed to bill team ${team_id} for ${creditsToBeBilled} credits: ${error}`);
// Optionally, you could notify an admin or add to a retry queue here // Optionally, you could notify an admin or add to a retry queue here
}); });

View File

@ -23,7 +23,7 @@ export async function getLinksFromSitemap(
const response = await axios.get(sitemapUrl, { timeout: axiosTimeout }); const response = await axios.get(sitemapUrl, { timeout: axiosTimeout });
content = response.data; content = response.data;
} else if (mode === 'fire-engine') { } else if (mode === 'fire-engine') {
const response = await scrapWithFireEngine({ url: sitemapUrl, fireEngineOptions: { engine:"tlsclient", disableJsDom: true, mobileProxy: true } }); const response = await scrapWithFireEngine({ url: sitemapUrl, fireEngineOptions: { engine:"chrome-cdp" } });
content = response.html; content = response.html;
} }
} catch (error) { } catch (error) {

View File

@ -159,7 +159,7 @@ const workerFun = async (
}, { }, {
...job.opts, ...job.opts,
jobId: job.id, jobId: job.id,
priority: Math.round((job.opts.priority ?? 10) * 1.25), // exponential backoff for stuck jobs priority: newJobPriority, // exponential backoff for stuck jobs
}); });
await sleep(gotJobInterval); await sleep(gotJobInterval);