Commit Graph

13 Commits

Author SHA1 Message Date
Copilot
03c7031a3c
Fix task duplication: add single/multi-instance support with UI configuration and stop all running instances (#2837)
* Initial plan

* Stop running tasks before starting new scheduled instance

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>

* Add multi-instance support and fix stop to kill all running instances

- Add allow_multiple_instances field to Crontab model (default: 0 for single instance)
- Add validation for new field in commonCronSchema
- Add getAllPids and killAllTasks utility functions
- Update stop method to kill ALL running instances of a task
- Update runCron to respect allow_multiple_instances config
- Backward compatible: defaults to single instance mode

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>

* Add UI support for allow_multiple_instances configuration

- Add allow_multiple_instances field to ICrontab interface
- Add instance mode selector in task creation/edit modal
- Add translations for instance mode in Chinese and English
- Default to single instance mode for backward compatibility

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>

* Add allow_multiple_instances column migration and optimize db.ts

- Add allow_multiple_instances column to Crontabs table migration
- Refactor migration code to use data-driven approach
- Replace 11 individual try-catch blocks with single loop
- Improve code maintainability and readability

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
2025-11-19 00:10:27 +08:00
whyour
7414a9d33d 执行任务增加结束日志 2024-08-31 14:43:44 +08:00
whyour
65f7483688 修复任务频繁运行通知 2024-08-25 16:28:32 +08:00
whyour
8b8eae211b 增加任务重复运行提醒 2024-08-23 09:37:26 +08:00
whyour
00818b694a 使用 spawn exit 方法监听进程退出 2023-10-07 22:51:44 +08:00
whyour
ec5b885476 修改任务队列执行日志 2023-10-06 02:34:40 +08:00
whyour
648b9c4520 修改系统日志时间打印 2023-08-26 20:51:17 +08:00
whyour
4f7649f157 系统设置增加系统运行日志 2023-08-21 00:10:43 +08:00
whyour
e7d023a7e0 支持多语言英文 2023-07-29 18:26:30 +08:00
whyour
702c3160ec 修改并发逻辑,系统设置增加定时任务并发设置 2023-07-01 15:26:20 +08:00
whyour
84828865f7 修复依赖安装流程 2023-06-18 15:51:35 +08:00
whyour
a7f97bd729 替换 spawn 为 cross-spawn 2023-05-31 14:25:20 +08:00
whyour
f8dfee8945 重构任务并发执行逻辑 2023-05-30 16:32:00 +08:00