I'm retard
All checks were successful
Docker build image / build (push) Successful in 26s

This commit is contained in:
Fijxu 2024-10-12 02:32:56 -03:00
parent 8738a17b29
commit 84770fb410
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4

View file

@ -2,33 +2,37 @@ const { createTask } = require('./lib/task')
const { fetchVisitorData } = require('./lib/workflow')
const { Redis } = require('ioredis')
const redis = new Redis({ host: process.env.HOST || config.host });
redis.on('error', (error) => {
console.error('Could not connect to Redis:', error);
process.exit(1);
console.error('Could not connect to Redis:', error);
process.exit(1);
});
const generate = async () => {
const visitorData = await fetchVisitorData()
const task = await createTask(visitorData)
const { poToken } = await task.start()
return { visitorData, poToken }
console.debug("[DEBUG] generate called")
try {
const visitorData = await fetchVisitorData()
const task = await createTask(visitorData)
const { poToken } = await task.start()
return { visitorData, poToken }
} catch (e) {
console.error(`generate: Error ${e}`)
}
}
const run = async () => {
try {
const { visitorData, poToken } = await generate();
p = redis.set("invidious:po_token", poToken)
v = redis.set("invidious:visitor_data", visitorData)
redis.set("invidious:po_token", poToken)
redis.set("invidious:visitor_data", visitorData)
} catch(e) {
console.error(`Fuck: ${e}`)
console.error(`run: Error ${e}`)
}
console.log("New tokens sent to redis")
}
run();
setTimeout(run, (process.env.RENEW_INTERVAL || 60) * 1000)
setInterval(run, (process.env.RENEW_INTERVAL || 60) * 1000)
module.exports = { generate }