Commit 3b22345603d077e03ae69cb42860db40b2248c34
1 parent
5c032219
asyncUpdateProcesInstance ,cause MySQL Dead Lock
Showing
1 changed file
with
10 additions
and
1 deletions
yudao-module-bpm/yudao-module-bpm-impl-flowable/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java
| @@ -30,6 +30,7 @@ import org.flowable.engine.repository.ProcessDefinition; | @@ -30,6 +30,7 @@ import org.flowable.engine.repository.ProcessDefinition; | ||
| 30 | import org.flowable.engine.runtime.ProcessInstance; | 30 | import org.flowable.engine.runtime.ProcessInstance; |
| 31 | import org.flowable.task.api.Task; | 31 | import org.flowable.task.api.Task; |
| 32 | import org.springframework.context.annotation.Lazy; | 32 | import org.springframework.context.annotation.Lazy; |
| 33 | +import org.springframework.scheduling.annotation.Async; | ||
| 33 | import org.springframework.stereotype.Service; | 34 | import org.springframework.stereotype.Service; |
| 34 | import org.springframework.transaction.annotation.Transactional; | 35 | import org.springframework.transaction.annotation.Transactional; |
| 35 | import org.springframework.validation.annotation.Validated; | 36 | import org.springframework.validation.annotation.Validated; |
| @@ -294,7 +295,15 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | @@ -294,7 +295,15 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService | ||
| 294 | // 补全流程实例的拓展表 | 295 | // 补全流程实例的拓展表 |
| 295 | //TODO startProcessInstance流程里面修改了 BpmProcessInstanceExt,没有提交,和下面的更新 锁持有冲突了,异步更新这个表 | 296 | //TODO startProcessInstance流程里面修改了 BpmProcessInstanceExt,没有提交,和下面的更新 锁持有冲突了,异步更新这个表 |
| 296 | // processInstanceExtMapper.updateByProcessInstanceId(new BpmProcessInstanceExtDO().setProcessInstanceId(instance.getId()).setFormVariables(variables)); | 297 | // processInstanceExtMapper.updateByProcessInstanceId(new BpmProcessInstanceExtDO().setProcessInstanceId(instance.getId()).setFormVariables(variables)); |
| 297 | - | 298 | + BpmProcessInstanceExtDO bpmProcessInstanceExtDO = new BpmProcessInstanceExtDO().setProcessInstanceId(instance.getId()).setFormVariables(variables); |
| 299 | + asyncUpdateProcesInstance(bpmProcessInstanceExtDO); | ||
| 298 | return instance.getId(); | 300 | return instance.getId(); |
| 299 | } | 301 | } |
| 302 | + | ||
| 303 | + @Async | ||
| 304 | + public void asyncUpdateProcesInstance(BpmProcessInstanceExtDO bpmProcessInstanceExtDO){ | ||
| 305 | + log.info("asyncUpdateProcesInstance ,cause MySQL Dead Lock"); | ||
| 306 | + processInstanceExtMapper.updateByProcessInstanceId(bpmProcessInstanceExtDO); | ||
| 307 | + | ||
| 308 | + } | ||
| 300 | } | 309 | } |