Skip to content

Commit

Permalink
Merge pull request #6985 from QwikDev/v2-merge-main-fix-build
Browse files Browse the repository at this point in the history
chore: merge main and fix build
  • Loading branch information
wmertens authored Oct 16, 2024
2 parents d271212 + f2acbcc commit 75fd3bc
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/insights/src/db/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function getEdges(
.from(edgeTable)
.where(where)
.groupBy(edgeTable.from, edgeTable.to)
.limit(limit || 10_000); // TODO: The 10_000 limit is due to Turso serialization format not being efficient, upgrade this once Turso is fixed.
.limit(limit || 5_000); // TODO: The 5_000 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
3 changes: 3 additions & 0 deletions packages/insights/src/db/sql-manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export async function dbGetManifests(
.from(manifestTable)
.where(and(eq(manifestTable.publicApiKey, publicApiKey)))
.orderBy(sql`${manifestTable.timestamp} DESC`)
.limit(1000)
.all();
return manifests;
}
Expand All @@ -37,6 +38,7 @@ export async function dbGetManifestStats(
.where(and(eq(manifestTable.publicApiKey, publicApiKey)))
.groupBy(manifestTable.hash)
.orderBy(sql`${manifestTable.timestamp} DESC`)
.limit(1000)
.all();
return manifests.map((manifest) => {
return {
Expand Down Expand Up @@ -94,6 +96,7 @@ export async function dbGetManifestHashes(
.where(and(eq(manifestTable.publicApiKey, publicApiKey)))
.groupBy(manifestTable.hash)
.orderBy(sql`${manifestTable.timestamp} DESC`)
.limit(1000)
.all();
const hashes: string[] = [];
let sum = 0;
Expand Down
3 changes: 3 additions & 0 deletions packages/insights/src/db/sql-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export async function getRoutes(
.where(where)
.groupBy(routesTable.route, routesTable.symbol)
.orderBy(sql`${routesTable.route}`, desc(sumTimelineCount))
.limit(1000)
.all();
return query.map((row) => ({
route: row.route,
Expand Down Expand Up @@ -63,6 +64,7 @@ export async function getRouteNames(
.where(where)
.groupBy(routesTable.route)
.orderBy(sql`${routesTable.route}`)
.limit(1000)
.all();
return query.map((row) => ({
route: row.route,
Expand Down Expand Up @@ -99,6 +101,7 @@ export async function getRouteTimeline(
.where(where)
.groupBy(routesTable.route, routesTable.symbol)
.orderBy(sql`${routesTable.route}`, desc(sumTimelineCount))
.limit(1000)
.all();
return query.map((row) => ({
route: row.route,
Expand Down
2 changes: 2 additions & 0 deletions packages/insights/src/db/sql-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const dbGetInsightUser = async (email: string): Promise<InsightsUser> =>
.leftJoin(userApplicationMap, eq(usersTable.id, userApplicationMap.userId))
.leftJoin(applicationTable, eq(applicationTable.id, userApplicationMap.applicationId))
.where(eq(usersTable.email, email))
.limit(1000)
.all();
if (users.length === 0) {
const insert = await db
Expand Down Expand Up @@ -72,6 +73,7 @@ export const dbGetUsersForApplication = async (publicApiKey: string) => {
.leftJoin(applicationTable, eq(applicationTable.id, userApplicationMap.applicationId))
.where(eq(applicationTable.publicApiKey, publicApiKey))
.orderBy(usersTable.email)
.limit(1000)
.all();
return users.map((user) => user.email);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export const onPost: RequestHandler = async ({ exit, json, request, params }) =>
const payloadJson = await request.json();
migrate1(payloadJson);
// publicApiKey is always part of the URL as route parameter.
payloadJson.publicApiKey = params.publicApiKey;
if (!payloadJson.publicApiKey) {
payloadJson.publicApiKey = params.publicApiKey;
}
const payload = InsightsPayload.parse(payloadJson);
// console.log('API: POST: symbol', payload);
exit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const onPost: RequestHandler = async ({ exit, json, request, params }) =>
eq(symbolDetailTable.manifestHash, manifestHash)
)
)
.limit(1000)
.all();
const existingMap = new Map<string, (typeof existing)[0]>();
existing.forEach((row) => existingMap.set(row.hash, row));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const useErrors = routeLoader$(async ({ params }) => {
.where(eq(errorTable.publicApiKey, params.publicApiKey))
.limit(1000)
.orderBy(sql`${errorTable.timestamp} DESC`)
.limit(1000)
.all();
return errors;
});
Expand Down
2 changes: 1 addition & 1 deletion packages/insights/src/routes/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const useApps = routeLoader$<ApplicationRow[]>(async ({ sharedMap }) => {
// The user has nothing attached to it.
return [];
}
return query.all();
return query.limit(1000).all();
});

export default component$(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-worker/src/worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { _deserializeData } from '@builder.io/qwik';
import { _deserialize } from '@builder.io/qwik';

globalThis.document = {
nodeType: 9,
Expand Down Expand Up @@ -30,7 +30,7 @@ globalThis.onmessage = async ({ data }) => {
},
};
try {
const [qrl, ...args] = _deserializeData(data[3], containerEl);
const [qrl, ...args] = _deserialize(data[3], containerEl);
const output = await qrl.apply(undefined, args);
self.postMessage([requestId, true, output]);
} catch (err) {
Expand Down

0 comments on commit 75fd3bc

Please sign in to comment.