From d631aada71a534154b49140507e1dc77a5857961 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Sun, 15 Dec 2024 23:31:15 -0300 Subject: [PATCH] I do not like deno.cron --- src/main.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index b67029d..fd3fb95 100644 --- a/src/main.ts +++ b/src/main.ts @@ -65,16 +65,19 @@ if (!innertubeClientOauthEnabled) { innertubeClientCache as UniversalCache, ); } - Deno.cron( - "regenerate youtube session", - konfigStore.get("jobs.youtube_session.frequency") as string, + setInterval( async () => { + const currentDateTime = new Date(); + console.log("regenrate token called: " + currentDateTime) if (innertubeClientJobPoTokenEnabled) { innertubeClient = await poTokenGenerate( innertubeClient, konfigStore, innertubeClientCache, ); + const currentDateTimexd = new Date(); + console.log("regenerate token finished: " + currentDateTimexd) + console.log("po_token: " + innertubeClient.session.po_token) } else { innertubeClient = await Innertube.create({ cache: innertubeClientCache, @@ -82,7 +85,7 @@ if (!innertubeClientOauthEnabled) { }); } }, - ); + konfigStore.get("jobs.youtube_session.frequency_seconds") as number * 1000 || 50000); } else if (innertubeClientOauthEnabled) { // Fired when waiting for the user to authorize the sign in attempt. innertubeClient.session.on("auth-pending", (data) => {