Skip to content

Commit

Permalink
fix(core): deleting an execution will still blocked the scheduler
Browse files Browse the repository at this point in the history
close #715
  • Loading branch information
tchiotludo committed Aug 31, 2022
1 parent 2671e5f commit 1782eca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions jdbc/src/main/java/io/kestra/jdbc/runner/JdbcScheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,18 @@ public void run() {
executionQueue.receive(
Scheduler.class,
execution -> {
if (execution.getState().getCurrent().isTerninated() && execution.getTrigger() != null) {
triggerRepository
.findByExecution(execution)
.ifPresent(trigger -> triggerRepository.save(trigger.resetExecution()));
if (
execution.getTrigger() != null && (
execution.isDeleted() ||
execution.getState().getCurrent().isTerninated()
)
) {
triggerRepository
.findByExecution(execution)
.ifPresent(trigger -> triggerRepository.save(trigger.resetExecution()));
}
}
});
);

super.run();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public StreamsBuilder topology() {
Named.as("TriggerCleaner.hasTriggerFilter")
)
.filter(
(key, value) -> conditionService.isTerminatedWithListeners(value.getFlow(), value.getExecution()),
(key, value) -> value.getExecution().isDeleted() || conditionService.isTerminatedWithListeners(value.getFlow(), value.getExecution()),
Named.as("TriggerCleaner.terminatedFilter")
)
.join(
Expand Down

0 comments on commit 1782eca

Please sign in to comment.