perf: remove this cache calculation bullshit, uses too much CPU
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m16s

This commit is contained in:
Fijxu 2025-02-17 00:30:15 -03:00
parent 2d2cc810f1
commit 6987dd8c0b
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4

View file

@ -1,6 +1,6 @@
import { Hono } from "hono";
import { Counter, Gauge, Registry } from "prom-client";
import { kv } from "../lib/helpers/youtubePlayerHandling.ts";
import { Counter, Gauge, Registry, } from "prom-client";
// import { kv } from "../lib/helpers/youtubePlayerHandling.ts";
const metrics = new Hono();
const METRICS_PREFIX = "invidious_companion_";
@ -35,12 +35,12 @@ export const successfulRequests = createCounter("successful_requests", "TODO");
export const retryCount = createCounter("retry_count", "TODO");
metrics.get("/", async () => {
let i = 0;
const entries = kv.list({ prefix: ["video_cache"] });
for await (const _ of entries) {
i += 1;
}
cachedEntries.set(i);
// let i = 0;
// const entries = kv.list({ prefix: ["video_cache"] });
// for await (const _ of entries) {
// i += 1;
// }
// cachedEntries.set(i);
return new Response(await register.metrics(), {
headers: { "Content-Type": "text/plain" },
});