Skip to content

Commit

Permalink
fix: log export limit (#664)
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcrt authored Nov 17, 2024
1 parent 22306c4 commit 67719e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/backend/src/api/v1/runs/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export async function fileExport(
} else {
line = line.trim().split("\n").slice(1).join("\\n");
}
// console.log(line);
yield line + "\n";
}
},
Expand Down
9 changes: 5 additions & 4 deletions packages/backend/src/api/v1/runs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ function formatRun(run: any) {
return formattedRun;
}

function getRunQuery({ ctx }: { ctx: Context }) {
// TODO: should not pass the context to this function
function getRunQuery(ctx: Context, isExport = false) {
const { projectId } = ctx.state;

const queryString = ctx.querystring;
Expand Down Expand Up @@ -368,7 +369,7 @@ function getRunQuery({ ctx }: { ctx: Context }) {
and (${filtersQuery})
order by
${sql.unsafe(orderByClause)}
limit ${Number(limit)}
limit ${isExport ? sql`all` : Number(limit)}
offset ${Number(page) * Number(limit)}
),
evaluation_results as (
Expand Down Expand Up @@ -552,7 +553,7 @@ runs.use("/ingest", ingest.routes());
*/
runs.get("/", async (ctx: Context) => {
const { query, projectId, parentRunCheck, filtersQuery, page, limit } =
getRunQuery({ ctx });
getRunQuery(ctx);

const rows = await query;
const runs = rows.map(formatRun);
Expand Down Expand Up @@ -1280,7 +1281,7 @@ runs.get("/exports/:token", async (ctx) => {
return ctx.throw(401, "Invalid token");
}

const { query, projectId } = getRunQuery({ ctx });
const { query, projectId } = getRunQuery(ctx, true);

await fileExport(
{ ctx, sql, cursor: query.cursor(), formatRun, projectId },
Expand Down

0 comments on commit 67719e1

Please sign in to comment.