refactor: Improve error handling and status preservation in auto-mode service

- Simplified the graceful shutdown process by removing redundant error handling for marking features as interrupted, as it is now managed internally.
- Updated orphan detection logging to streamline the process and enhance clarity.
- Added logic to preserve specific pipeline statuses when marking features as interrupted, ensuring correct resumption of features after a server restart.
- Enhanced unit tests to cover new behavior for preserving pipeline statuses and handling various feature states.
This commit is contained in:
Shirone
2026-01-25 14:57:23 +01:00
parent 011ac404bb
commit ef779daedf
4 changed files with 156 additions and 21 deletions

View File

@@ -787,11 +787,8 @@ const gracefulShutdown = async (signal: string) => {
// Mark all running features as interrupted before shutdown
// This ensures they can be resumed when the server restarts
try {
await autoModeService.markAllRunningFeaturesInterrupted(`${signal} signal received`);
} catch (error) {
logger.error('Failed to mark running features as interrupted:', error);
}
// Note: markAllRunningFeaturesInterrupted handles errors internally and never rejects
await autoModeService.markAllRunningFeaturesInterrupted(`${signal} signal received`);
terminalService.cleanup();
server.close(() => {