Add new batch scheduler service

This commit is contained in:
2025-06-07 15:31:59 +09:00
parent ffb9ba644e
commit b413162033
4 changed files with 212 additions and 21 deletions

View File

@ -378,6 +378,31 @@ app.post("/api/admin/batch/trigger", async (c) => {
}
});
app.post("/api/admin/batch/force-stop", async (c) => {
try {
console.log("🛑 Force stop batch process requested via admin panel");
const stopped = batchScheduler.forceStop();
if (stopped) {
return c.json({
result: "STOPPED",
message: "Batch process force stop signal sent",
timestamp: new Date().toISOString()
});
} else {
return c.json({
result: "NO_PROCESS",
message: "No batch process is currently running",
timestamp: new Date().toISOString()
}, 200);
}
} catch (error) {
console.error("Error force stopping batch process:", error);
return c.json({ error: "Failed to force stop batch process" }, 500);
}
});
// Static file handlers for admin panel UI
app.get("/assets/*", async (c) => {
try {