I do not like deno.cron
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 53s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 53s
This commit is contained in:
parent
ea0823a9ea
commit
d631aada71
1 changed files with 7 additions and 4 deletions
11
src/main.ts
11
src/main.ts
|
@ -65,16 +65,19 @@ if (!innertubeClientOauthEnabled) {
|
||||||
innertubeClientCache as UniversalCache,
|
innertubeClientCache as UniversalCache,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Deno.cron(
|
setInterval(
|
||||||
"regenerate youtube session",
|
|
||||||
konfigStore.get("jobs.youtube_session.frequency") as string,
|
|
||||||
async () => {
|
async () => {
|
||||||
|
const currentDateTime = new Date();
|
||||||
|
console.log("regenrate token called: " + currentDateTime)
|
||||||
if (innertubeClientJobPoTokenEnabled) {
|
if (innertubeClientJobPoTokenEnabled) {
|
||||||
innertubeClient = await poTokenGenerate(
|
innertubeClient = await poTokenGenerate(
|
||||||
innertubeClient,
|
innertubeClient,
|
||||||
konfigStore,
|
konfigStore,
|
||||||
innertubeClientCache,
|
innertubeClientCache,
|
||||||
);
|
);
|
||||||
|
const currentDateTimexd = new Date();
|
||||||
|
console.log("regenerate token finished: " + currentDateTimexd)
|
||||||
|
console.log("po_token: " + innertubeClient.session.po_token)
|
||||||
} else {
|
} else {
|
||||||
innertubeClient = await Innertube.create({
|
innertubeClient = await Innertube.create({
|
||||||
cache: innertubeClientCache,
|
cache: innertubeClientCache,
|
||||||
|
@ -82,7 +85,7 @@ if (!innertubeClientOauthEnabled) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
konfigStore.get("jobs.youtube_session.frequency_seconds") as number * 1000 || 50000);
|
||||||
} else if (innertubeClientOauthEnabled) {
|
} else if (innertubeClientOauthEnabled) {
|
||||||
// Fired when waiting for the user to authorize the sign in attempt.
|
// Fired when waiting for the user to authorize the sign in attempt.
|
||||||
innertubeClient.session.on("auth-pending", (data) => {
|
innertubeClient.session.on("auth-pending", (data) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue