jobqueue and stauts service
This commit is contained in:
1 parent
3bdfe5567d
commit
602597abe2
8 files changed
+270
-124
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { IMonitor, ICheck } from "@/db/models/index.js";
|
||||
import { IMonitor } from "@/db/models/index.js";
|
||||
import { INetworkService } from "./NetworkService.js";
|
||||
import { ICheckService } from "../business/CheckService.js";
|
||||
import { IMonitorStatsService } from "../business/MonitorStatsService.js";
|
||||
@@ -6,17 +6,15 @@ import { IStatusService } from "./StatusService.js";
|
||||
import { INotificationService } from "./NotificationService.js";
|
||||
import { IMaintenanceService } from "../business/MaintenanceService.js";
|
||||
import { IIncidentService } from "../business/IncidentService.js";
|
||||
import StatsAggregationService, {
|
||||
IStatsAggregationService,
|
||||
} from "@/services/business/StatsAggregationService.js";
|
||||
import { StatsHourly } from "@/db/models/index.js";
|
||||
import { IStatsAggregationService } from "@/services/business/StatsAggregationService.js";
|
||||
import ApiError from "@/utils/ApiError.js";
|
||||
import { getChildLogger } from "@/logger/Logger.js";
|
||||
import type { Monitor as MonitorEntity } from "@/types/domain/index.js";
|
||||
|
||||
const SERVICE_NAME = "JobGenerator";
|
||||
const logger = getChildLogger(SERVICE_NAME);
|
||||
export interface IJobGenerator {
|
||||
generateJob: () => (Monitor: IMonitor) => Promise<void>;
|
||||
generateJob: () => (monitor: MonitorEntity) => Promise<void>;
|
||||
generateCleanupJob: () => () => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -53,9 +51,9 @@ class JobGenerator implements IJobGenerator {
|
||||
}
|
||||
|
||||
generateJob = () => {
|
||||
return async (monitor: IMonitor) => {
|
||||
return async (monitor: MonitorEntity) => {
|
||||
try {
|
||||
const monitorId = monitor._id.toString();
|
||||
const monitorId = monitor.id.toString();
|
||||
if (!monitorId) {
|
||||
throw new ApiError("No monitorID for creating job", 400);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user