Fix/plugin workflow migration (#3404)

* fix(plugin-workflow): fix migration

* fix(plugin-workflow): add job.nodeKey when saving
This commit is contained in:
Junyi 2024-01-17 20:09:24 +08:00 committed by GitHub
parent 8d06b73c48
commit a4b9544944
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 9 additions and 3 deletions

View File

@ -91,6 +91,7 @@ export default class extends Instruction {
status: JOB_STATUS.PENDING,
result: null,
nodeId: node.id,
nodeKey: node.key,
upstreamId: prevJob?.id ?? null,
});
job.node = node;

View File

@ -32,6 +32,7 @@ export default class extends Instruction {
// save loop index
result: 0,
nodeId: node.id,
nodeKey: node.key,
upstreamId: prevJob?.id ?? null,
});

View File

@ -99,6 +99,7 @@ export default class extends Instruction {
status: JOB_STATUS.PENDING,
result: mode ? [] : null,
nodeId: node.id,
nodeKey: node.key,
upstreamId: prevJob?.id ?? null,
});

View File

@ -61,6 +61,7 @@ export default class extends Instruction {
status: JOB_STATUS.PENDING,
result: Array(branches.length).fill(null),
nodeId: node.id,
nodeKey: node.key,
upstreamId: prevJob?.id ?? null,
});

View File

@ -44,6 +44,7 @@ export default class extends Instruction {
const job = await processor.saveJob({
status: JOB_STATUS.PENDING,
nodeId: node.id,
nodeKey: node.key,
upstreamId: prevJob?.id ?? null,
});

View File

@ -139,6 +139,7 @@ export default class Processor {
if (!(job instanceof Model)) {
job.upstreamId = prevJob instanceof Model ? prevJob.get('id') : null;
job.nodeId = node.id;
job.nodeKey = node.key;
}
const savedJob = await this.saveJob(job);
@ -222,8 +223,7 @@ export default class Processor {
}
this.jobsMap.set(job.id, job);
const node = this.nodesMap.get(job.nodeId);
this.jobsMapByNodeKey[node.key] = job.result;
this.jobsMapByNodeKey[job.nodeKey] = job.result;
return job;
}

View File

@ -152,6 +152,7 @@ export class ConditionInstruction extends Instruction {
result,
// TODO(optimize): try unify the building of job
nodeId: node.id,
nodeKey: node.key,
upstreamId: (prevJob && prevJob.id) || null,
};

View File

@ -20,7 +20,7 @@ export default class extends Migration {
}
return job.update(
{
nodeKey: job.node.key,
nodeKey: job.node?.key,
},
{
silent: true,