feat: Implement configurable scheduler settings and enhance CSV import functionality

This commit is contained in:
Max Kowalski
2025-06-27 16:55:25 +02:00
parent 1dd618b666
commit 50b230aa9b
10 changed files with 457 additions and 48 deletions

View File

@ -1,9 +1,10 @@
// Custom Next.js server with scheduler initialization
// Custom Next.js server with configurable scheduler initialization
import { createServer } from "http";
import { parse } from "url";
import next from "next";
import { startScheduler } from "./lib/scheduler.js";
import { startCsvImportScheduler } from "./lib/scheduler.js";
import { startProcessingScheduler } from "./lib/processingScheduler.js";
import { getSchedulerConfig, logSchedulerConfig } from "./lib/schedulerConfig.js";
const dev = process.env.NODE_ENV !== "production";
const hostname = "localhost";
@ -14,11 +15,17 @@ const app = next({ dev, hostname, port });
const handle = app.getRequestHandler();
app.prepare().then(() => {
// Initialize schedulers when the server starts
console.log("Starting schedulers...");
startScheduler();
startProcessingScheduler();
console.log("All schedulers initialized successfully");
// Get and log scheduler configuration
const config = getSchedulerConfig();
logSchedulerConfig(config);
// Initialize schedulers based on configuration
if (config.enabled) {
console.log("Initializing schedulers...");
startCsvImportScheduler();
startProcessingScheduler();
console.log("All schedulers initialized successfully");
}
createServer(async (req, res) => {
try {