Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(map): correct time_taken calculation in v1 /map endpoint (#3243)

Andrew Barnes26eacb9844db
diff --git a/apps/api/src/controllers/v1/map.ts b/apps/api/src/controllers/v1/map.ts
index 5026311a1..b9751c055 100644
--- a/apps/api/src/controllers/v1/map.ts
+++ b/apps/api/src/controllers/v1/map.ts
@@ -123,6 +123,7 @@ export async function getMapResults({
headers?: Record<string, string>;
id?: string;
}): Promise<MapResult> {
+ const startTime = Date.now();
const id = providedId ?? uuidv7();
let links: string[] = [url];
let mapResults: MapDocument[] = [];
@@ -354,7 +355,7 @@ export async function getMapResults({
mapResults: mapResults,
scrape_id: origin?.includes("website") ? id : undefined,
job_id: id,
- time_taken: (new Date().getTime() - Date.now()) / 1000,
+ time_taken: (Date.now() - startTime) / 1000,
};
}