mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
【功能修复】定时任务在多租户下,没有记录执行的日志结果
This commit is contained in:
parent
dfb1b6b823
commit
d8d385e489
@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.tenant.core.job;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.service.TenantFrameworkService;
|
import cn.iocoder.yudao.framework.tenant.core.service.TenantFrameworkService;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
||||||
@ -44,7 +45,8 @@ public class TenantJobAspect {
|
|||||||
// TODO 芋艿:先通过 parallel 实现并行;1)多个租户,是一条执行日志;2)异常的情况
|
// TODO 芋艿:先通过 parallel 实现并行;1)多个租户,是一条执行日志;2)异常的情况
|
||||||
TenantUtils.execute(tenantId, () -> {
|
TenantUtils.execute(tenantId, () -> {
|
||||||
try {
|
try {
|
||||||
joinPoint.proceed();
|
Object result = joinPoint.proceed();
|
||||||
|
results.put(tenantId, StrUtil.toStringOrNull(result));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
log.error("[execute][租户({}) 执行 Job 发生异常", tenantId, e);
|
log.error("[execute][租户({}) 执行 Job 发生异常", tenantId, e);
|
||||||
results.put(tenantId, ExceptionUtil.getRootCauseMessage(e));
|
results.put(tenantId, ExceptionUtil.getRootCauseMessage(e));
|
||||||
|
Loading…
Reference in New Issue
Block a user