feat: es6+mods and replace node-cron with croner

This commit is contained in:
Andres 2023-10-08 16:37:26 +02:00
parent 19c92ed244
commit ea828c326f
9 changed files with 10437 additions and 374 deletions

View file

@ -4,7 +4,7 @@ import logger from "morgan";
import compression from "compression";
import bearerToken from "express-bearer-token";
import helmet from "helmet";
import cron from "node-cron";
import { Cron } from "croner";
import { db } from "./utils/db.js";
import { initAdmin } from "./utils/init-admin.js";
@ -63,7 +63,7 @@ initAdmin().then(function (admin) {
if (process.env.ZU_LAST_SEEN_FETCH !== "false") {
let schedule = process.env.ZU_LAST_SEEN_SCHEDULE || "*/5 * * * *";
cron.schedule(schedule, () => {
Cron(schedule, () => {
console.debug("Running scheduled job");
const networks = db.get("networks").value();
networks.forEach(async (network) => {