fix: dont pad numbers in redis key dates
This commit is contained in:
parent
ed3aed85ad
commit
2f9f2d81bf
@ -34,7 +34,10 @@ export const MainLayout = (
|
||||
<title>{title}</title>}
|
||||
</Head>
|
||||
<aside class="p-4 hidden md:block">
|
||||
<nav class="min-h-fit rounded-3xl p-3 grid gap-3 fixed t-0">
|
||||
<nav
|
||||
class="min-h-fit rounded-3xl p-3 grid gap-3 fixed t-0"
|
||||
hx-boost="true"
|
||||
>
|
||||
{Object.values(resources).map((m) => {
|
||||
return (
|
||||
<a
|
||||
|
138
fresh.gen.ts
138
fresh.gen.ts
@ -6,41 +6,40 @@ import * as $0 from "./routes/_404.tsx";
|
||||
import * as $1 from "./routes/_app.tsx";
|
||||
import * as $2 from "./routes/_middleware.ts";
|
||||
import * as $3 from "./routes/admin/log/index.tsx";
|
||||
import * as $4 from "./routes/admin/performance/api.ts";
|
||||
import * as $5 from "./routes/admin/performance/index.tsx";
|
||||
import * as $6 from "./routes/api/articles/[name].ts";
|
||||
import * as $7 from "./routes/api/articles/create/index.ts";
|
||||
import * as $8 from "./routes/api/articles/index.ts";
|
||||
import * as $9 from "./routes/api/auth/callback.ts";
|
||||
import * as $10 from "./routes/api/auth/login.ts";
|
||||
import * as $11 from "./routes/api/auth/logout.ts";
|
||||
import * as $12 from "./routes/api/cache/index.ts";
|
||||
import * as $13 from "./routes/api/images/index.ts";
|
||||
import * as $14 from "./routes/api/index.ts";
|
||||
import * as $15 from "./routes/api/logs.ts";
|
||||
import * as $16 from "./routes/api/movies/[name].ts";
|
||||
import * as $17 from "./routes/api/movies/enhance/[name].ts";
|
||||
import * as $18 from "./routes/api/movies/index.ts";
|
||||
import * as $19 from "./routes/api/query/index.ts";
|
||||
import * as $20 from "./routes/api/query/sync.ts";
|
||||
import * as $21 from "./routes/api/recipes/[name].ts";
|
||||
import * as $22 from "./routes/api/recipes/index.ts";
|
||||
import * as $23 from "./routes/api/resources.ts";
|
||||
import * as $24 from "./routes/api/series/[name].ts";
|
||||
import * as $25 from "./routes/api/series/enhance/[name].ts";
|
||||
import * as $26 from "./routes/api/series/index.ts";
|
||||
import * as $27 from "./routes/api/tmdb/[id].ts";
|
||||
import * as $28 from "./routes/api/tmdb/credits/[id].ts";
|
||||
import * as $29 from "./routes/api/tmdb/query.ts";
|
||||
import * as $30 from "./routes/articles/[name].tsx";
|
||||
import * as $31 from "./routes/articles/index.tsx";
|
||||
import * as $32 from "./routes/index.tsx";
|
||||
import * as $33 from "./routes/movies/[name].tsx";
|
||||
import * as $34 from "./routes/movies/index.tsx";
|
||||
import * as $35 from "./routes/recipes/[name].tsx";
|
||||
import * as $36 from "./routes/recipes/index.tsx";
|
||||
import * as $37 from "./routes/series/[name].tsx";
|
||||
import * as $38 from "./routes/series/index.tsx";
|
||||
import * as $4 from "./routes/admin/performance/index.tsx";
|
||||
import * as $5 from "./routes/api/articles/[name].ts";
|
||||
import * as $6 from "./routes/api/articles/create/index.ts";
|
||||
import * as $7 from "./routes/api/articles/index.ts";
|
||||
import * as $8 from "./routes/api/auth/callback.ts";
|
||||
import * as $9 from "./routes/api/auth/login.ts";
|
||||
import * as $10 from "./routes/api/auth/logout.ts";
|
||||
import * as $11 from "./routes/api/cache/index.ts";
|
||||
import * as $12 from "./routes/api/images/index.ts";
|
||||
import * as $13 from "./routes/api/index.ts";
|
||||
import * as $14 from "./routes/api/logs.ts";
|
||||
import * as $15 from "./routes/api/movies/[name].ts";
|
||||
import * as $16 from "./routes/api/movies/enhance/[name].ts";
|
||||
import * as $17 from "./routes/api/movies/index.ts";
|
||||
import * as $18 from "./routes/api/query/index.ts";
|
||||
import * as $19 from "./routes/api/query/sync.ts";
|
||||
import * as $20 from "./routes/api/recipes/[name].ts";
|
||||
import * as $21 from "./routes/api/recipes/index.ts";
|
||||
import * as $22 from "./routes/api/resources.ts";
|
||||
import * as $23 from "./routes/api/series/[name].ts";
|
||||
import * as $24 from "./routes/api/series/enhance/[name].ts";
|
||||
import * as $25 from "./routes/api/series/index.ts";
|
||||
import * as $26 from "./routes/api/tmdb/[id].ts";
|
||||
import * as $27 from "./routes/api/tmdb/credits/[id].ts";
|
||||
import * as $28 from "./routes/api/tmdb/query.ts";
|
||||
import * as $29 from "./routes/articles/[name].tsx";
|
||||
import * as $30 from "./routes/articles/index.tsx";
|
||||
import * as $31 from "./routes/index.tsx";
|
||||
import * as $32 from "./routes/movies/[name].tsx";
|
||||
import * as $33 from "./routes/movies/index.tsx";
|
||||
import * as $34 from "./routes/recipes/[name].tsx";
|
||||
import * as $35 from "./routes/recipes/index.tsx";
|
||||
import * as $36 from "./routes/series/[name].tsx";
|
||||
import * as $37 from "./routes/series/index.tsx";
|
||||
import * as $$0 from "./islands/Counter.tsx";
|
||||
import * as $$1 from "./islands/IngredientsList.tsx";
|
||||
import * as $$2 from "./islands/KMenu.tsx";
|
||||
@ -59,41 +58,40 @@ const manifest = {
|
||||
"./routes/_app.tsx": $1,
|
||||
"./routes/_middleware.ts": $2,
|
||||
"./routes/admin/log/index.tsx": $3,
|
||||
"./routes/admin/performance/api.ts": $4,
|
||||
"./routes/admin/performance/index.tsx": $5,
|
||||
"./routes/api/articles/[name].ts": $6,
|
||||
"./routes/api/articles/create/index.ts": $7,
|
||||
"./routes/api/articles/index.ts": $8,
|
||||
"./routes/api/auth/callback.ts": $9,
|
||||
"./routes/api/auth/login.ts": $10,
|
||||
"./routes/api/auth/logout.ts": $11,
|
||||
"./routes/api/cache/index.ts": $12,
|
||||
"./routes/api/images/index.ts": $13,
|
||||
"./routes/api/index.ts": $14,
|
||||
"./routes/api/logs.ts": $15,
|
||||
"./routes/api/movies/[name].ts": $16,
|
||||
"./routes/api/movies/enhance/[name].ts": $17,
|
||||
"./routes/api/movies/index.ts": $18,
|
||||
"./routes/api/query/index.ts": $19,
|
||||
"./routes/api/query/sync.ts": $20,
|
||||
"./routes/api/recipes/[name].ts": $21,
|
||||
"./routes/api/recipes/index.ts": $22,
|
||||
"./routes/api/resources.ts": $23,
|
||||
"./routes/api/series/[name].ts": $24,
|
||||
"./routes/api/series/enhance/[name].ts": $25,
|
||||
"./routes/api/series/index.ts": $26,
|
||||
"./routes/api/tmdb/[id].ts": $27,
|
||||
"./routes/api/tmdb/credits/[id].ts": $28,
|
||||
"./routes/api/tmdb/query.ts": $29,
|
||||
"./routes/articles/[name].tsx": $30,
|
||||
"./routes/articles/index.tsx": $31,
|
||||
"./routes/index.tsx": $32,
|
||||
"./routes/movies/[name].tsx": $33,
|
||||
"./routes/movies/index.tsx": $34,
|
||||
"./routes/recipes/[name].tsx": $35,
|
||||
"./routes/recipes/index.tsx": $36,
|
||||
"./routes/series/[name].tsx": $37,
|
||||
"./routes/series/index.tsx": $38,
|
||||
"./routes/admin/performance/index.tsx": $4,
|
||||
"./routes/api/articles/[name].ts": $5,
|
||||
"./routes/api/articles/create/index.ts": $6,
|
||||
"./routes/api/articles/index.ts": $7,
|
||||
"./routes/api/auth/callback.ts": $8,
|
||||
"./routes/api/auth/login.ts": $9,
|
||||
"./routes/api/auth/logout.ts": $10,
|
||||
"./routes/api/cache/index.ts": $11,
|
||||
"./routes/api/images/index.ts": $12,
|
||||
"./routes/api/index.ts": $13,
|
||||
"./routes/api/logs.ts": $14,
|
||||
"./routes/api/movies/[name].ts": $15,
|
||||
"./routes/api/movies/enhance/[name].ts": $16,
|
||||
"./routes/api/movies/index.ts": $17,
|
||||
"./routes/api/query/index.ts": $18,
|
||||
"./routes/api/query/sync.ts": $19,
|
||||
"./routes/api/recipes/[name].ts": $20,
|
||||
"./routes/api/recipes/index.ts": $21,
|
||||
"./routes/api/resources.ts": $22,
|
||||
"./routes/api/series/[name].ts": $23,
|
||||
"./routes/api/series/enhance/[name].ts": $24,
|
||||
"./routes/api/series/index.ts": $25,
|
||||
"./routes/api/tmdb/[id].ts": $26,
|
||||
"./routes/api/tmdb/credits/[id].ts": $27,
|
||||
"./routes/api/tmdb/query.ts": $28,
|
||||
"./routes/articles/[name].tsx": $29,
|
||||
"./routes/articles/index.tsx": $30,
|
||||
"./routes/index.tsx": $31,
|
||||
"./routes/movies/[name].tsx": $32,
|
||||
"./routes/movies/index.tsx": $33,
|
||||
"./routes/recipes/[name].tsx": $34,
|
||||
"./routes/recipes/index.tsx": $35,
|
||||
"./routes/series/[name].tsx": $36,
|
||||
"./routes/series/index.tsx": $37,
|
||||
},
|
||||
islands: {
|
||||
"./islands/Counter.tsx": $$0,
|
||||
|
4
lib/cache/logs.ts
vendored
4
lib/cache/logs.ts
vendored
@ -19,8 +19,8 @@ export type Log = {
|
||||
export async function getLogs() {
|
||||
const d = new Date();
|
||||
const year = d.getFullYear();
|
||||
const month = d.getMonth().toString().padStart(2, "0");
|
||||
const day = d.getDate().toString().padStart(2, "0");
|
||||
const month = d.getMonth().toString();
|
||||
const day = d.getDate().toString();
|
||||
|
||||
const keys = await cache.keys(
|
||||
`log:${year}:${month}:${day}:*`,
|
||||
|
6
lib/cache/performance.ts
vendored
6
lib/cache/performance.ts
vendored
@ -36,13 +36,15 @@ export const savePerformance = (url: string, milliseconds: number) => {
|
||||
export async function getPerformances(): Promise<PerformanceRes> {
|
||||
const d = new Date();
|
||||
const year = d.getFullYear();
|
||||
const month = d.getMonth().toString().padStart(2, "0");
|
||||
const day = d.getDay().toString().padStart(2, "0");
|
||||
const month = d.getMonth().toString();
|
||||
const day = d.getDay().toString();
|
||||
|
||||
const keys = await cache.keys(
|
||||
`performance:${year}:${month}:${day}:*`,
|
||||
);
|
||||
|
||||
console.log(`performance:${year}:${month}:${day}:*`);
|
||||
|
||||
const performances = await Promise.all(
|
||||
keys.map(async (key) =>
|
||||
JSON.parse(await cache.get<string>(key)) as PerformancePoint
|
||||
|
@ -116,11 +116,11 @@ function componentToHex(c: number) {
|
||||
export function getTimeCacheKey() {
|
||||
const d = new Date();
|
||||
const year = d.getFullYear();
|
||||
const month = d.getMonth().toString().padStart(2, "0");
|
||||
const day = d.getDate().toString().padStart(2, "0");
|
||||
const hour = d.getHours().toString().padStart(2, "0");
|
||||
const minute = d.getMinutes().toString().padStart(2, "0");
|
||||
const seconds = d.getSeconds().toString().padStart(2, "0");
|
||||
const month = d.getMonth().toString();
|
||||
const day = d.getDate().toString();
|
||||
const hour = d.getHours().toString();
|
||||
const minute = d.getMinutes().toString();
|
||||
const seconds = d.getSeconds().toString();
|
||||
return `${year}:${month}:${day}:${hour}:${minute}:${seconds}`;
|
||||
}
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
import { getPerformances } from "@lib/cache/performance.ts";
|
||||
import { json } from "@lib/helpers.ts";
|
||||
|
||||
export const handler: Handlers = {
|
||||
async GET() {
|
||||
return json(await getPerformances());
|
||||
},
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user