Revert "hotfix: move middleware to after JobQueue initialization"

This commit is contained in:
Alexander Holliday
2024-12-23 15:52:16 -08:00
committed by GitHub
parent b2e2d08561
commit bd81c49b1e

View File

@ -70,6 +70,15 @@ const startApp = async () => {
app.use(express.json());
app.use(helmet());
// Add db, jobQueue, emailService, and settingsService to request object for easy access
app.use((req, res, next) => {
req.db = db;
req.jobQueue = jobQueue;
req.emailService = emailService;
req.settingsService = settingsService;
next();
});
// Swagger UI
app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(openApiSpec));
@ -153,15 +162,6 @@ const startApp = async () => {
Worker
);
// Add db, jobQueue, emailService, and settingsService to request object for easy access
app.use((req, res, next) => {
req.db = db;
req.jobQueue = jobQueue;
req.emailService = emailService;
req.settingsService = settingsService;
next();
});
const shutdown = async () => {
if (isShuttingDown) {
return;