feat: move perf,logs and user into sqlite

This commit is contained in:
2025-01-05 18:03:59 +01:00
parent 1937ef55bb
commit bf7d88a588
25 changed files with 524 additions and 145 deletions

View File

@@ -1,14 +1,14 @@
//routes/middleware-error-handler/_middleware.ts
import { MiddlewareHandlerContext } from "$fresh/server.ts";
import { FreshContext } from "$fresh/server.ts";
import { DomainError } from "@lib/errors.ts";
import { getCookies } from "@std/http/cookie";
import { verify } from "https://deno.land/x/djwt@v2.2/mod.ts";
import * as cache from "@lib/cache/performance.ts";
import * as perf from "@lib/performance.ts";
import { JWT_SECRET } from "@lib/env.ts";
export async function handler(
req: Request,
ctx: MiddlewareHandlerContext,
ctx: FreshContext,
) {
try {
performance.mark("a");
@@ -29,7 +29,7 @@ export async function handler(
const resp = await ctx.next();
performance.mark("b");
const b = performance.measure("a->b", "a", "b");
cache.savePerformance(req.url, b.duration);
perf.savePerformance(req.url, b.duration);
return resp;
} catch (error) {
console.error("Error", error);