Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update XxlJobInfoMapper.xml(解决调度中心调度过程中停止的job启动问题) #3514

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zhangbing-bing
Copy link

@zhangbing-bing zhangbing-bing commented Jul 20, 2024

修复bug
服务端在执行调度器的时候,先将任务status为1的满足时间条件的定时任务取出,最终也会更新xxl_job_info的status状态。在这个中间时刻,我发出了关闭定时任务的请求,调度器后续的更新操作又会将xxl_job_info的status改为正常运行状态。

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

The description of the PR:

Other information:

修复bug
服务端在执行调度器的时候,先将任务status为1的满足时间条件的定时任务取出,最终也会更新xxl_job_info的status状态。在这个中间时刻,我发出了关闭定时任务的请求,调度器后续的更新操作又会将xxl_job_info的status改为正常运行状态。
@zhangbing-bing
Copy link
Author

zhangbing-bing commented Jul 20, 2024

这是使用的过程中遇到的问题,分析了一下原因,虽然在调度的时候加了写锁:select * from xxl_job_lock where lock_name = 'schedule_lock' for update;
但是这个写锁只是针对这个表的xxl_job_lock ,xxl_job_info中要更新的字段并没有加锁(只有在执行到的时候才加锁),所以其它事务在它还没有加锁之前是可以修改的,就可能会引起在管理后台把任务停了,但是任务又被调度器启动的情况;
这里我觉得不应该更新任务状态,所以直接删除了这个更新字段。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant