feat: implement infinite scrolling for native sessions and add reset functionality to queue scheduler

This commit is contained in:
catlog22
2026-02-27 21:24:44 +08:00
parent a581a2e62b
commit 9be35ed5fb
12 changed files with 263 additions and 131 deletions

View File

@@ -46,6 +46,10 @@ export async function handleQueueSchedulerRoutes(
for (const item of items) {
schedulerService.addItem(item);
}
} else if (state.status === 'completed' || state.status === 'failed') {
// Auto-reset when scheduler is in terminal state and start fresh
schedulerService.reset();
schedulerService.start(items);
} else {
return {
error: `Cannot add items when scheduler is in '${state.status}' state`,
@@ -131,6 +135,22 @@ export async function handleQueueSchedulerRoutes(
return true;
}
// POST /api/queue/scheduler/reset - Reset scheduler to idle state
if (pathname === '/api/queue/scheduler/reset' && req.method === 'POST') {
handlePostRequest(req, res, async () => {
try {
schedulerService.reset();
return {
success: true,
state: schedulerService.getState(),
};
} catch (err) {
return { error: (err as Error).message, status: 409 };
}
});
return true;
}
// POST /api/queue/scheduler/config - Update scheduler configuration
if (pathname === '/api/queue/scheduler/config' && req.method === 'POST') {
handlePostRequest(req, res, async (body) => {