lot/oldapp/app.js
2022-05-12 16:33:35 +01:00

49 lines
910 B
JavaScript

const loader = require("./libs/loader");
const lot = require("./libs/lot");
const lotv2 = require("./libs/lotV2");
const pusher = require("./libs/pusher");
const log4js = require("log4js");
const logger = log4js.getLogger();
const cron = require("node-cron");
const { retrieveNew } = require("./libs/retriever");
logger.level = "debug";
function run(data) {
const v1 = lot.calculate(data);
const v2 = lotv2.calculate(data);
const msg = `V2: ${v2} stars: ${v1.mainstars}
V1: ${v1.mainline} stars: ${v1.mainstars}
Other: ${v1.otherLine} stars: ${v1.otherStars}
`;
pusher.push(msg);
logger.debug(msg);
// loader.save(data);
}
function go() {
logger.info("GO!");
loader.load(run);
retrieveNew();
}
cron.schedule("10 15 * * 2,5", () => {
go();
return -1;
});
cron.schedule("45 9 * * 3,6", () => {
retrieveNew();
return -1;
});
logger.info("Lot V3 started...");
retrieveNew();