det101 commented on code in PR #17678:
URL:
https://github.com/apache/dolphinscheduler/pull/17678#discussion_r2540243841
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:
##########
@@ -409,14 +409,16 @@ public void saveWorkflowLineage(long projectCode,
long workflowDefinitionCode,
int workflowDefinitionVersion,
List<TaskDefinitionLog>
taskDefinitionLogList) {
- List<WorkflowTaskLineage> workflowTaskLineageList =
- generateWorkflowLineageList(taskDefinitionLogList,
workflowDefinitionCode, workflowDefinitionVersion);
- if (workflowTaskLineageList.isEmpty()) {
- return;
- }
+ List<WorkflowTaskLineage> workflowTaskLineageList =
generateWorkflowLineageList(taskDefinitionLogList,
+ workflowDefinitionCode, workflowDefinitionVersion);
- int insertWorkflowLineageResult =
workflowLineageService.updateWorkflowLineage(workflowTaskLineageList);
- if (insertWorkflowLineageResult <= 0) {
+ int insertWorkflowLineageResult =
+
workflowLineageService.updateWorkflowLineage(workflowDefinitionCode,
workflowTaskLineageList);
+ if (CollectionUtils.isEmpty(workflowTaskLineageList)) {
+ log.info(
+ "Delete workflow lineage because current lineage is empty,
projectCode: {}, workflowDefinitionCode: {}, workflowDefinitionVersion: {}",
+ projectCode, workflowDefinitionCode,
workflowDefinitionVersion);
+ } else if (insertWorkflowLineageResult <= 0) {
Review Comment:
As you suggested, I refactored: Instead of deleting the logs directly, I
moved the lineage logic to WorkflowTaskLineageService.updateWorkflowLineage()
and simplified WorkflowDefinitionService.saveWorkflowLineage().
--
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]