fix: 修复定时任务状态暂停时执行单次任务会触发cron表达式的问题 #31
This commit is contained in:
@@ -201,9 +201,12 @@ class SchedulerUtil:
|
|||||||
job_executor = job_info.job_executor
|
job_executor = job_info.job_executor
|
||||||
if iscoroutinefunction(job_func):
|
if iscoroutinefunction(job_func):
|
||||||
job_executor = 'default'
|
job_executor = 'default'
|
||||||
|
job_trigger = DateTrigger()
|
||||||
|
if job_info.status == '0':
|
||||||
|
job_trigger = OrTrigger(triggers=[DateTrigger(), MyCronTrigger.from_crontab(job_info.cron_expression)])
|
||||||
scheduler.add_job(
|
scheduler.add_job(
|
||||||
func=eval(job_info.invoke_target),
|
func=eval(job_info.invoke_target),
|
||||||
trigger=OrTrigger(triggers=[DateTrigger(), MyCronTrigger.from_crontab(job_info.cron_expression)]),
|
trigger=job_trigger,
|
||||||
args=job_info.job_args.split(',') if job_info.job_args else None,
|
args=job_info.job_args.split(',') if job_info.job_args else None,
|
||||||
kwargs=json.loads(job_info.job_kwargs) if job_info.job_kwargs else None,
|
kwargs=json.loads(job_info.job_kwargs) if job_info.job_kwargs else None,
|
||||||
id=str(job_info.job_id),
|
id=str(job_info.job_id),
|
||||||
|
Reference in New Issue
Block a user