feat: some shit
Some checks failed
Deploy to GitHub Pages / build_site (push) Failing after 37s

This commit is contained in:
2024-12-19 23:55:07 +01:00
parent a740da1099
commit 540d0549d7
14 changed files with 58 additions and 40 deletions

View File

@@ -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,

View File

@@ -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");

View File

@@ -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, {