fix: 相同的注册任务,创建不同的job参数不同,并发执行存在任务回调问题 #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
场景:
同一个jobHandle 指定不同的参数
jobHandle = xx
job 1 : 参数: param1
job 2 : 参数: param2
出现问题:
job1和job2 同时执行的时候 回调只有一个能够成功
问题分析:
注册: RegTask("xx", srv.XxFunc)
获取:task := e.regList.Get(param.ExecutorHandler)
job1 和 job2 同时执行的时候 , task 指向的都是同一个地址
job 1先到达执行器执行 job 1用的就是regList的task地址, 对task的 Id 等进行赋值
在job1 未执行完毕,job 2到达的时候 , job 2用的也是regList的task地址, 只是重新赋值, 覆盖了之前job 1的 id 等参数,
导致 job1 和 job2 执行成功 回调的参数都是job2 ,在xxl-job-admin的后台看到 job1 存在日志但是一直没有收到回调