Refactor queue handling by removing WorkerNotification and updating job configurations in SendReportsToSubscribers

This commit is contained in:
Simon Larsen 2024-09-22 14:24:29 +01:00
parent 9be007cbda
commit 3809b4585a
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
4 changed files with 3 additions and 25 deletions

View File

@ -14,8 +14,7 @@ import { ExpressRouter } from "../Utils/Express";
export enum QueueName {
Workflow = "Workflow",
Worker = "Worker",
WorkerNotification = "WorkerNotification",
Worker = "Worker"
}
export type QueueJob = Job;

View File

@ -81,7 +81,7 @@ export default class Recurring extends DatabaseProperty {
if (nextDate.getTime() <= dateNow.getTime()) {
while (nextDate.getTime() <= dateNow.getTime()) {
nextDate = this.getNextDateInterval(startDate, rotation);
nextDate = this.getNextDateInterval(nextDate, rotation);
}
}

View File

@ -7,14 +7,12 @@ import StatusPageService from "Common/Server/Services/StatusPageService";
import QueryHelper from "Common/Server/Types/Database/QueryHelper";
import logger from "Common/Server/Utils/Logger";
import StatusPage from "Common/Models/DatabaseModels/StatusPage";
import { QueueName } from "Common/Server/Infrastructure/Queue";
RunCron(
"StatusPage:SendReportToSubscribers",
{
schedule: EVERY_MINUTE,
runOnStartup: false,
queueName: QueueName.WorkerNotification,
runOnStartup: false
},
async () => {
// get all scheduled events of all the projects.

View File

@ -133,25 +133,6 @@ const WorkersFeatureSet: FeatureSet = {
{ concurrency: 100 },
);
// Job process.
QueueWorker.getWorker(
QueueName.WorkerNotification,
async (job: QueueJob) => {
const name: string = job.name;
logger.debug("Running Job: " + name);
const funcToRun: PromiseVoidFunction =
JobDictionary.getJobFunction(name);
const timeoutInMs: number = JobDictionary.getTimeoutInMs(name);
if (funcToRun) {
await QueueWorker.runJobWithTimeout(timeoutInMs, funcToRun);
}
},
{ concurrency: 100 },
);
} catch (err) {
logger.error("App Init Failed:");
logger.error(err);