ruanwenjun commented on code in PR #15883:
URL:
https://github.com/apache/dolphinscheduler/pull/15883#discussion_r1574086014
##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/TriggerRelationServiceImpl.java:
##########
@@ -45,29 +51,44 @@ public void saveTriggerToDb(ApiTriggerType type, Long
triggerCode, Integer jobId
triggerRelation.setUpdateTime(new Date());
triggerRelationMapper.upsert(triggerRelation);
}
+
@Override
- public TriggerRelation queryByTypeAndJobId(ApiTriggerType apiTriggerType,
int jobId) {
+ public List<TriggerRelation> queryByTypeAndJobId(ApiTriggerType
apiTriggerType, int jobId) {
return
triggerRelationMapper.queryByTypeAndJobId(apiTriggerType.getCode(), jobId);
}
@Override
public int saveCommandTrigger(Integer commandId, Integer
processInstanceId) {
- TriggerRelation exist = queryByTypeAndJobId(ApiTriggerType.PROCESS,
processInstanceId);
- if (exist == null) {
+ List<TriggerRelation> existTriggers =
queryByTypeAndJobId(ApiTriggerType.PROCESS, processInstanceId);
+ if (CollectionUtils.isEmpty(existTriggers)) {
return 0;
}
- saveTriggerToDb(ApiTriggerType.COMMAND, exist.getTriggerCode(),
commandId);
- return 1;
+ existTriggers.forEach(triggerRelation ->
saveTriggerToDb(ApiTriggerType.COMMAND,
Review Comment:
AFAIK, this table is only used for querying the workflow instance by
rest-api, it will to affect the other api.
BTW, this table can be removed if we can generate the workflow instance in
api-side when manual trigger a workflow instance, I have a plan to create a
DSIP for this. This can help to reduce the complexity.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]