diff --git a/server/src/controllers/queueController.ts b/server/src/controllers/queueController.ts index 9885bab87..9ae2b494a 100755 --- a/server/src/controllers/queueController.ts +++ b/server/src/controllers/queueController.ts @@ -1,11 +1,12 @@ +import { ISuperSimpleQueue } from "@/service/index.js"; import { Request, Response, NextFunction } from "express"; const SERVICE_NAME = "JobQueueController"; class JobQueueController { static SERVICE_NAME = SERVICE_NAME; - private jobQueue: any; - constructor(jobQueue: any) { + private jobQueue: ISuperSimpleQueue; + constructor(jobQueue: ISuperSimpleQueue) { this.jobQueue = jobQueue; } @@ -53,18 +54,6 @@ class JobQueueController { } }; - addJob = async (req: Request, res: Response, next: NextFunction) => { - try { - await this.jobQueue.addJob(Math.random().toString(36).substring(7)); - return res.status(200).json({ - success: true, - msg: "Job added to queue successfully", - }); - } catch (error) { - next(error); - } - }; - flushQueue = async (req: Request, res: Response, next: NextFunction) => { try { const result = await this.jobQueue.flushQueues(); @@ -77,18 +66,5 @@ class JobQueueController { next(error); } }; - - checkQueueHealth = async (req: Request, res: Response, next: NextFunction) => { - try { - const stuckQueues = await this.jobQueue.checkQueueHealth(); - return res.status(200).json({ - success: true, - msg: "Queue health checked successfully", - data: stuckQueues, - }); - } catch (error) { - next(error); - } - }; } export default JobQueueController; diff --git a/server/src/routes/queueRoute.ts b/server/src/routes/queueRoute.ts index d5b036b15..dd3b27999 100755 --- a/server/src/routes/queueRoute.ts +++ b/server/src/routes/queueRoute.ts @@ -11,10 +11,8 @@ class QueueRoutes { } initRoutes() { this.router.get("/jobs", isAllowed(["admin", "superadmin"]), this.queueController.getJobs); - this.router.post("/jobs", isAllowed(["admin", "superadmin"]), this.queueController.addJob); this.router.get("/metrics", isAllowed(["admin", "superadmin"]), this.queueController.getMetrics); - this.router.get("/health", isAllowed(["admin", "superadmin"]), this.queueController.checkQueueHealth); this.router.get("/all-metrics", isAllowed(["admin", "superadmin"]), this.queueController.getAllMetrics); this.router.post("/flush", isAllowed(["admin", "superadmin"]), this.queueController.flushQueue); }