lot/oldapp/app.js

49 lines
910 B
JavaScript
Raw Normal View History

2021-01-02 19:30:30 +00:00
const loader = require("./libs/loader");
const lot = require("./libs/lot");
const lotv2 = require("./libs/lotV2");
const pusher = require("./libs/pusher");
const log4js = require("log4js");
2017-09-08 09:49:24 +00:00
const logger = log4js.getLogger();
2021-01-02 19:30:30 +00:00
const cron = require("node-cron");
2017-09-08 09:45:53 +00:00
2021-01-02 19:30:30 +00:00
const { retrieveNew } = require("./libs/retriever");
2019-02-08 14:54:18 +00:00
2021-01-02 19:30:30 +00:00
logger.level = "debug";
2017-09-08 09:45:53 +00:00
function run(data) {
const v1 = lot.calculate(data);
const v2 = lotv2.calculate(data);
2021-01-02 19:30:30 +00:00
const msg = `V2: ${v2} stars: ${v1.mainstars}
2017-09-08 09:45:53 +00:00
V1: ${v1.mainline} stars: ${v1.mainstars}
2021-01-02 19:30:30 +00:00
Other: ${v1.otherLine} stars: ${v1.otherStars}
2017-09-08 09:45:53 +00:00
`;
pusher.push(msg);
2017-09-08 09:49:24 +00:00
logger.debug(msg);
2019-02-08 14:54:18 +00:00
// loader.save(data);
2017-09-08 09:45:53 +00:00
}
function go() {
2021-01-02 19:30:30 +00:00
logger.info("GO!");
2017-09-08 09:45:53 +00:00
loader.load(run);
2021-01-02 19:30:30 +00:00
retrieveNew();
2017-09-08 09:45:53 +00:00
}
2021-01-02 19:30:30 +00:00
cron.schedule("10 15 * * 2,5", () => {
2017-09-08 09:45:53 +00:00
go();
2017-09-08 09:49:24 +00:00
2017-09-08 09:45:53 +00:00
return -1;
});
2017-09-08 09:49:24 +00:00
2021-01-02 19:30:30 +00:00
cron.schedule("45 9 * * 3,6", () => {
2019-02-19 15:57:16 +00:00
retrieveNew();
2019-02-08 14:54:18 +00:00
return -1;
});
2021-01-02 19:30:30 +00:00
logger.info("Lot V3 started...");
retrieveNew();