mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 14:49:07 +00:00
Refactor queue handling by removing WorkerNotification and updating job configurations in SendReportsToSubscribers
This commit is contained in:
parent
9be007cbda
commit
3809b4585a
@ -14,8 +14,7 @@ import { ExpressRouter } from "../Utils/Express";
|
||||
|
||||
export enum QueueName {
|
||||
Workflow = "Workflow",
|
||||
Worker = "Worker",
|
||||
WorkerNotification = "WorkerNotification",
|
||||
Worker = "Worker"
|
||||
}
|
||||
|
||||
export type QueueJob = Job;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user