fix: dont pad numbers in redis key dates
This commit is contained in:
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
|
||||
|
Reference in New Issue
Block a user