Linked Rabbiteer & Crons
This commit is contained in:
parent
0ce2785b75
commit
8b136eb565
8 changed files with 58 additions and 8 deletions
|
@ -1,14 +1,13 @@
|
|||
import "dotenv/config"; // Load Envars
|
||||
|
||||
// Imports
|
||||
import fig from "figlet";
|
||||
import http from "http";
|
||||
import { INFO, OK, logInfo } from "../util/logging.js";
|
||||
// import "../utils/preload.js"; // Load Globals
|
||||
|
||||
// Import Core Modules
|
||||
import expressApp from "./server.js";
|
||||
import applySockets from "../sockets/handler.js";
|
||||
import JobManager from "./JobManager.js";
|
||||
import rabbiteer from "../rabbit/rabbit-workers.js";
|
||||
|
||||
// Constants
|
||||
const title = "QLTR";
|
||||
|
@ -25,9 +24,10 @@ export default class Qualiteer {
|
|||
async _preinitialize() {
|
||||
logInfo(fig.textSync(title, "Cosmike"));
|
||||
INFO("INIT", "Initializing...");
|
||||
this.app = (await import("./server.js")).default;
|
||||
this.app = expressApp;
|
||||
this.server = http.createServer(this.app);
|
||||
this.sockets = applySockets(this.server, this.jobs);
|
||||
this.rabbiteer = rabbiteer;
|
||||
}
|
||||
|
||||
start() {
|
||||
|
|
13
lib/core/crons.js
Normal file
13
lib/core/crons.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import cron from "cron";
|
||||
const { CronJob } = cron;
|
||||
|
||||
// Remove Expired Silenced Tests
|
||||
const expiredSilenced = () => {
|
||||
console.log("Would Update Silenced Tests");
|
||||
};
|
||||
|
||||
const silencedCron = new CronJob("* * * * * *", expiredSilenced);
|
||||
|
||||
export default async function startCrons() {
|
||||
silencedCron.start();
|
||||
}
|
|
@ -11,3 +11,5 @@ app.all("/", (req, res) => res.redirect("/qualiteer"));
|
|||
|
||||
// Routes
|
||||
app.use("/api/results", results);
|
||||
|
||||
export default app;
|
||||
|
|
14
lib/rabbit/rabbit-workers.js
Normal file
14
lib/rabbit/rabbit-workers.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
import Rabbiteer from "rabbiteer";
|
||||
import workers from "./workers/index.js";
|
||||
|
||||
// Pull Environment Variables
|
||||
const { RABBIT_HOST: host, RABBIT_USER: user, RABBIT_PASS: pass } = process.env;
|
||||
|
||||
// Rabbit Config
|
||||
const rabbitConfig = {
|
||||
host: host ?? "localhost",
|
||||
user: user ?? "rabbit",
|
||||
pass: pass ?? "rabbit",
|
||||
};
|
||||
|
||||
export default new Rabbiteer(null, workers, { autoRabbit: rabbitConfig });
|
|
@ -1,7 +1,7 @@
|
|||
// Imports
|
||||
import { RabbitConsumer } from "rabiteer";
|
||||
import { Worker } from "rabbiteer";
|
||||
// Class
|
||||
export default class TestResultsConsumer extends RabbitConsumer {
|
||||
export default class TestResultsWorker extends Worker {
|
||||
constructor() {
|
||||
super("TestResults");
|
||||
}
|
3
lib/rabbit/workers/index.js
Normal file
3
lib/rabbit/workers/index.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
import TestResultsWorker from "./TestResultsWorker.js";
|
||||
|
||||
export default [new TestResultsWorker()];
|
Loading…
Add table
Add a link
Reference in a new issue