Skip to content

Commit 2bb2758

Browse files
fix(core): safeguard for null flow when trying to reset trigger in JdbcExecutor (#13381)
1 parent 98bdfb5 commit 2bb2758

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

jdbc/src/main/java/io/kestra/jdbc/runner/JdbcExecutor.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,11 +1136,18 @@ private void toExecution(Executor executor, boolean ignoreFailure) {
11361136
// We need to detect that and reset them as they will never reach the reset code later on this method.
11371137
if (execution.getTrigger() != null && execution.getState().isFailed() && ListUtils.isEmpty(execution.getTaskRunList())) {
11381138
FlowWithSource flow = executor.getFlow();
1139-
triggerRepository
1140-
.findByExecution(execution)
1141-
.ifPresent(trigger -> {
1142-
this.triggerState.update(executionService.resetExecution(flow, execution, trigger));
1143-
});
1139+
1140+
if (flow == null) {
1141+
log.error("Couldn't reset trigger for execution {} as flow {} is missing. Trigger {} might stay stuck.",
1142+
execution.getId(),
1143+
execution.getTenantId() + "/" + execution.getNamespace() + "/" + execution.getFlowId(),
1144+
execution.getTrigger().getId()
1145+
);
1146+
} else {
1147+
triggerRepository
1148+
.findByExecution(execution)
1149+
.ifPresent(trigger -> this.triggerState.update(executionService.resetExecution(flow, execution, trigger)));
1150+
}
11441151
}
11451152

11461153
return;

0 commit comments

Comments
 (0)