this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

๐Ÿ‘ฉโ€๐Ÿ’ปโ€ Refresh wakatime cache less often

+6 -6
+6 -6
src/wakatime.ts
··· 1 - import { writeFile, mkdir, readFile } from "node:fs/promises"; 2 - import path from "node:path"; 3 1 import { file } from "astro/loaders"; 4 - import { getSecret } from "astro:env/server"; 5 - import { defineCollection } from "astro:content"; 6 2 import { z } from "astro/zod"; 7 - import { differenceInHours } from "date-fns"; 3 + import { defineCollection } from "astro:content"; 4 + import { getSecret } from "astro:env/server"; 5 + import { differenceInMonths } from "date-fns"; 6 + import { mkdir, readFile, writeFile } from "node:fs/promises"; 7 + import path from "node:path"; 8 8 9 9 export async function wakatimeCollection( 10 10 cachepath: string, ··· 32 32 const cachedResponse = JSON.parse((await readFile(cachepath)).toString()); 33 33 // cache is fresh enough 34 34 if ( 35 - differenceInHours(new Date(), new Date(cachedResponse.writtenAt)) < 24 35 + differenceInMonths(new Date(), new Date(cachedResponse.writtenAt)) < 2 36 36 ) { 37 37 return cachedResponse; 38 38 }