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) => {