Skip to content

feat(cron):定时任务控制后台#1810

Open
JAVA-LW wants to merge 5 commits intoiOfficeAI:mainfrom
JAVA-LW:codex/cron-control-panel-clean
Open

feat(cron):定时任务控制后台#1810
JAVA-LW wants to merge 5 commits intoiOfficeAI:mainfrom
JAVA-LW:codex/cron-control-panel-clean

Conversation

@JAVA-LW
Copy link
Copy Markdown
Contributor

@JAVA-LW JAVA-LW commented Mar 27, 2026

Pull Request

Description

就是支持手动创建重复定时任务
550968ed6ed3292ef075b987edf940d0

Related Issues

#1809

  • Closes #

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

  • Tested on macOS
  • Tested on Windows
  • Tested on Linux
  • My code follows the project's code style guidelines
  • I have performed a self-review of my own code
  • My changes generate no new warnings or errors

Screenshots

Additional Context


Thank you for contributing to AionUi! 🎉

@JAVA-LW JAVA-LW changed the title 定时任务控制后台 feat(cron)定时任务控制后台 Mar 27, 2026
@JAVA-LW JAVA-LW changed the title feat(cron)定时任务控制后台 feat(cron):定时任务控制后台 Mar 27, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b3d3d194c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +674 to +676
let nextRunAtMs = anchor;
while (nextRunAtMs <= now) {
nextRunAtMs += schedule.everyMs;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Compute next interval run in O(1) instead of looping

This loop advances one interval at a time from startAtMs, so an old high-frequency job (for example, every minute with an anchor months ago) can require hundreds of thousands of iterations each time nextRunAtMs is recomputed. Because this helper is used during timer start and after executions, the cost grows with job age and can cause avoidable CPU spikes. Compute the next tick with arithmetic based on (now - anchor) / everyMs to keep this path constant-time.

Useful? React with 👍 / 👎.

Comment on lines +152 to +154
const months = Array.from({ length: 12 }, (_value, index) => index + 1).filter(
(month) => (month - startMonth + 12) % intervalValue === 0
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject month intervals that cannot be represented correctly

The month field is generated by selecting matching months inside a single year, which silently breaks intervals that do not divide 12. For example, an "every 5 months" input yields 1,6,11, producing gaps of 5, 5, then 2 months across year boundaries, so runs are not actually every 5 months as the UI suggests. Either constrain allowed month intervals (e.g., divisors of 12) or use a schedule encoding that preserves constant month spacing.

Useful? React with 👍 / 👎.

Comment on lines +331 to +334
await ipcBridge.cron.addJob.invoke({
name: values.name.trim(),
schedule,
message: trimmedMessage,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor create-form enabled state when adding a cron job

In create mode the form exposes an enabled/disabled switch, but the create path ignores values.enabled and always calls addJob with the default enabled behavior. Users who set the new job to disabled will still get an active scheduled task immediately. Persist the requested state (or explicitly pause right after creation) so the UI control matches runtime behavior.

Useful? React with 👍 / 👎.

- 在多语言文件中添加月度间隔不支持的提示信息
- 实现 isMonthIntervalSupported 函数验证月度间隔的有效性
- 在 CronJobDrawer 组件中添加月度间隔验证规则
- 支持在创建定时任务时指定启用状态
- 修复 CronService 中的 getNextEveryRunAtMs 计算逻辑
- 移除未使用的 CronMessageMeta 类型定义
- 添加相关单元测试验证功能正确性
@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Mar 29, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 29, 2026

合并冲突(无法自动解决)

本 PR 与目标分支存在冲突,自动 rebase 未能干净解决。请手动 rebase 后重新 push:

git fetch origin
git rebase origin/main
# 解决冲突后
git push --force-with-lease

@piorpua piorpua added bot:needs-human-review Blocking issues — human must intervene and removed bot:reviewing Review in progress (mutex) labels Mar 29, 2026
# Conflicts:
#	src/process/services/database/migrations.ts
#	src/renderer/pages/settings/components/SettingsPageWrapper.tsx
#	src/renderer/pages/settings/components/SettingsSider.tsx
@IceyLiu
Copy link
Copy Markdown
Collaborator

IceyLiu commented Mar 31, 2026

@JAVA-LW 定时任务会大改哦,后面再看这里

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:needs-human-review Blocking issues — human must intervene

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants