Nick: links-billed update (temp)

This commit is contained in:
Nicolas 2025-01-08 15:13:33 -03:00
parent 363021ea78
commit aa31508ccd
2 changed files with 13 additions and 3 deletions

View File

@ -4,4 +4,8 @@ export const extractConfig = {
INITIAL_SCORE_THRESHOLD: 0.75, INITIAL_SCORE_THRESHOLD: 0.75,
FALLBACK_SCORE_THRESHOLD: 0.5, FALLBACK_SCORE_THRESHOLD: 0.5,
MIN_REQUIRED_LINKS: 1, MIN_REQUIRED_LINKS: 1,
}; };
export const CUSTOM_U_TEAMS = [
"874d40cc-a5c0-4e93-b661-9ddfbad5e51e"
]

View File

@ -10,6 +10,7 @@ import { logJob } from "../../services/logging/log_job";
import { _addScrapeJobToBullMQ } from "../../services/queue-jobs"; import { _addScrapeJobToBullMQ } from "../../services/queue-jobs";
import { saveCrawl, StoredCrawl } from "../crawl-redis"; import { saveCrawl, StoredCrawl } from "../crawl-redis";
import { updateExtract } from "./extract-redis"; import { updateExtract } from "./extract-redis";
import { CUSTOM_U_TEAMS } from "./config";
interface ExtractServiceOptions { interface ExtractServiceOptions {
request: ExtractRequest; request: ExtractRequest;
@ -182,10 +183,15 @@ export async function performExtraction(extractId: string, options: ExtractServi
// }, {}, crypto.randomUUID(), 50); // }, {}, crypto.randomUUID(), 50);
// }); // });
let linksBilled = links.length * 5;
if(CUSTOM_U_TEAMS.includes(teamId)){
linksBilled = 1;
}
// Bill team for usage // Bill team for usage
billTeam(teamId, subId, links.length * 5).catch((error) => { billTeam(teamId, subId, linksBilled).catch((error) => {
logger.error( logger.error(
`Failed to bill team ${teamId} for ${links.length * 5} credits: ${error}`, `Failed to bill team ${teamId} for ${linksBilled} credits: ${error}`,
); );
}); });