Skip to content

Commit

Permalink
fix(insights): put limits to prevent too many results error (QwikDev#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery authored Sep 11, 2023
1 parent f9114d6 commit 98145bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/insights/src/db/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function getEdges(
) {
let where = eq(edgeTable.publicApiKey, publicApiKey);
if (typeof manifestHashSample == 'undefined') {
manifestHashSample = 500000; // max number of interactions. May need to be configurable in the future.
manifestHashSample = 100000; // max number of interactions. May need to be configurable in the future.
}
if (typeof manifestHashSample == 'number' && !manifestHashes) {
manifestHashes = await dbGetManifestHashes(db, publicApiKey, {
Expand All @@ -53,7 +53,7 @@ export async function getEdges(
.from(edgeTable)
.where(where)
.groupBy(edgeTable.from, edgeTable.to)
.limit(limit || Number.MAX_SAFE_INTEGER);
.limit(limit || 3000); // TODO: The 3000 limit is due to Turso serialization format not being efficient, upgrade this once Turso is fixed.
const rows = await query.all();
return rows.map((e) => ({
from: e.from,
Expand Down

0 comments on commit 98145bc

Please sign in to comment.