This commit is contained in:
@@ -129,6 +129,7 @@ const getNodeWasmRoute = createRoute({
|
||||
nodeRouter.openapi(getNodeWasmRoute, async (c) => {
|
||||
const { user, system, nodeId } = c.req.valid("param");
|
||||
|
||||
const a = performance.now();
|
||||
const wasmContent = await service.getNodeWasmById(
|
||||
user,
|
||||
system,
|
||||
|
||||
@@ -110,6 +110,7 @@ export async function getNodeWasmById(
|
||||
systemId: string,
|
||||
nodeId: string,
|
||||
) {
|
||||
const a = performance.now();
|
||||
const node = await db.select({ content: nodeTable.content }).from(nodeTable)
|
||||
.where(
|
||||
and(
|
||||
@@ -117,7 +118,8 @@ export async function getNodeWasmById(
|
||||
eq(nodeTable.systemId, systemId),
|
||||
eq(nodeTable.nodeId, nodeId),
|
||||
),
|
||||
).limit(1);
|
||||
).limit(1).execute();
|
||||
console.log("Time to load wasm", performance.now() - a);
|
||||
|
||||
if (!node[0]) {
|
||||
throw new Error("Node not found");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
customType,
|
||||
index,
|
||||
integer,
|
||||
json,
|
||||
pgTable,
|
||||
@@ -27,7 +28,12 @@ export const nodeTable = pgTable("nodes", {
|
||||
definition: json().notNull(),
|
||||
hash: varchar({ length: 8 }).notNull(),
|
||||
previous: integer(),
|
||||
});
|
||||
}, (table) => [
|
||||
index("user_id_idx").on(table.userId),
|
||||
index("system_id_idx").on(table.systemId),
|
||||
index("node_id_idx").on(table.nodeId),
|
||||
index("hash_idx").on(table.hash),
|
||||
]);
|
||||
|
||||
export const nodeRelations = relations(nodeTable, ({ one }) => ({
|
||||
userId: one(usersTable, {
|
||||
|
||||
Reference in New Issue
Block a user