feat: 3.1.0

1. 优化工作流重试逻辑
This commit is contained in:
byteblogs168 2024-02-27 23:25:39 +08:00
parent e95174085b
commit 9baba9ee8b
11 changed files with 40 additions and 40 deletions

View File

@ -71,6 +71,8 @@ public abstract class AbstractClientCallbackHandler implements ClientCallbackHan
updateJobTask.setClientInfo(newClient);
// 覆盖老的的客户端信息
context.setClientInfo(newClient);
} else {
context.setClientInfo(context.getJobTask().getClientInfo());
}
Job job = context.getJob();
@ -83,6 +85,14 @@ public abstract class AbstractClientCallbackHandler implements ClientCallbackHan
private boolean isNeedRetry(ClientCallbackContext context) {
JobTask jobTask = jobTaskMapper.selectById(context.getTaskId());
Job job = jobMapper.selectById(context.getJobId());
context.setJob(job);
context.setJobTask(jobTask);
if (Objects.isNull(jobTask) || Objects.isNull(job)) {
return Boolean.FALSE;
}
// 手动重试策略
if (Objects.nonNull(context.getRetryScene())
&& Objects.equals(JobRetrySceneEnum.MANUAL.getRetryScene(), context.getRetryScene())
@ -91,17 +101,7 @@ public abstract class AbstractClientCallbackHandler implements ClientCallbackHan
}
if (context.getTaskStatus().equals(JobTaskStatusEnum.FAIL.getStatus())) {
JobTask jobTask = jobTaskMapper.selectById(context.getTaskId());
Job job = jobMapper.selectById(context.getJobId());
if (Objects.isNull(jobTask) || Objects.isNull(job)) {
return Boolean.FALSE;
}
if (jobTask.getRetryCount() < job.getMaxRetryTimes()) {
context.setClientInfo(jobTask.getClientInfo());
context.setJob(job);
context.setJobTask(jobTask);
context.setRetryScene(JobRetrySceneEnum.AUTO.getRetryScene());
return Boolean.TRUE;
}

View File

@ -49,6 +49,7 @@ public class JobHandler {
public Boolean retry(Long taskBatchId) {
return retry(taskBatchId, null, null);
}
public Boolean retry(Long taskBatchId, Long workflowNodeId, Long workflowTaskBatchId) {
JobTaskBatch jobTaskBatch = jobTaskBatchMapper.selectOne(new LambdaQueryWrapper<JobTaskBatch>()
.eq(JobTaskBatch::getId, taskBatchId)
@ -65,7 +66,9 @@ public class JobHandler {
Job job = jobMapper.selectById(jobTaskBatch.getJobId());
Assert.notNull(job, () -> new EasyRetryServerException("job can not be null."));
List<JobTask> jobTasks = jobTaskMapper.selectList(new LambdaQueryWrapper<JobTask>()
List<JobTask> jobTasks = jobTaskMapper.selectList(
new LambdaQueryWrapper<JobTask>()
.select(JobTask::getId, JobTask::getTaskStatus)
.eq(JobTask::getTaskBatchId, taskBatchId));
// 若任务项为空则生成

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,8 +5,8 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Easy Retry</title>
<script type="module" crossorigin src="./assets/fjGXFx1T.js"></script>
<link rel="stylesheet" crossorigin href="./assets/RihNDpOw.css">
<script type="module" crossorigin src="./assets/9sLx2M6c.js"></script>
<link rel="stylesheet" crossorigin href="./assets/n6fbhMQt.css">
</head>
<body>

View File

@ -21,8 +21,8 @@ const jobApi = {
// 通知
jobNotifyConfigPageList: '/job/notify/config/page/list',
jobNotifyConfigDetail: '/job/notify/config/',
saveJobNotify: '/job/notify/config/',
updateJobNotify: '/job/notify/config/',
saveJobNotify: '/job/notify/config',
updateJobNotify: '/job/notify/config',
// 任务
jobTaskList: '/job/task/list',

View File

@ -71,8 +71,6 @@
:rowKey="(record) => record.id"
:columns="columns"
:data="loadData"
:alert="options.alert"
:rowSelection="options.rowSelection"
:scroll="{ x: 1500 }"
>
<span slot="serial" slot-scope="record">
@ -279,7 +277,7 @@ export default {
if (status === 0) {
this.$message.error('停止失败')
} else {
this.$refs.table.refresh(true)
this.$refs.table.refresh(false)
this.$message.success('停止成功')
}
})
@ -290,7 +288,7 @@ export default {
if (status === 0) {
this.$message.error('重试失败')
} else {
this.$refs.table.refresh(true)
this.$refs.table.refresh(false)
this.$message.success('重试成功')
}
})

View File

@ -62,10 +62,10 @@
:rowKey="(record) => record.id"
:columns="notifyColumns"
:data="loadData"
:alert="options.alert"
:rowSelection="options.rowSelection"
>
<span slot="serial" slot-scope="record">
{{ record.id }}
</span>
<span slot="notifyType" slot-scope="text">
<a-tag :color="notifyTypeList[text].color">
{{ notifyTypeList[text].name }}
@ -110,6 +110,11 @@ export default {
data () {
return {
notifyColumns: [
{
title: 'ID',
scopedSlots: { customRender: 'serial' },
fixed: 'left'
},
{
title: '组名',
dataIndex: 'groupName',

View File

@ -70,8 +70,6 @@
:rowKey="(record) => record.id"
:columns="columns"
:data="loadData"
:alert="options.alert"
:rowSelection="options.rowSelection"
:scroll="{ x: 1500 }"
>
<span slot="serial" slot-scope="record">

View File

@ -45,8 +45,6 @@
:rowKey="(record) => record.id"
:columns="notifyColumns"
:data="loadData"
:alert="options.alert"
:rowSelection="options.rowSelection"
>
<span slot="notifyType" slot-scope="text">
<a-tag :color="notifyTypeList[text].color">

View File

@ -54,8 +54,6 @@
rowKey="key"
:columns="columns"
:data="loadData"
:alert="options.alert"
:rowSelection="options.rowSelection"
:scroll="{ x: 2000 }"
>
<span slot="uniqueId" slot-scope="text, record">