Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(webserver, ui): avoid cancelled SSE connection from following exec #6738

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ui/src/components/executions/ExecutionRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@
if (isEnd) {
this.closeSSE();
}
this.throttledExecutionUpdate(executionEvent);
// we are receiving a first "fake" event to force initializing the connection: ignoring it
if (executionEvent.lastEventId !== "start") {
this.throttledExecutionUpdate(executionEvent);
}
if (isEnd) {
this.throttledExecutionUpdate.flush();
}
Expand Down
5 changes: 4 additions & 1 deletion ui/src/components/executions/Topology.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@
if (isEnd) {
this.closeSubExecutionSSE(subflow);
}
this.throttledExecutionUpdate(subflow, executionEvent);
// we are receiving a first "fake" event to force initializing the connection: ignoring it
if (executionEvent.lastEventId !== "start") {
this.throttledExecutionUpdate(subflow, executionEvent);
}
if (isEnd) {
this.throttledExecutionUpdate.flush();
}
Expand Down
5 changes: 4 additions & 1 deletion ui/src/components/logs/TaskRunDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,10 @@
if (isEnd) {
this.closeExecutionSSE();
}
this.throttledExecutionUpdate(executionEvent);
// we are receiving a first "fake" event to force initializing the connection: ignoring it
if (executionEvent.lastEventId !== "start") {
this.throttledExecutionUpdate(executionEvent);
}
if (isEnd) {
this.throttledExecutionUpdate.flush();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1474,8 +1474,11 @@ public Flux<Event<Execution>> follow(

return Flux
.<Event<Execution>>create(emitter -> {
// send a first "empty" event so the SSE is correctly initialized in the frontend in case there are no logs
emitter.next(Event.of(Execution.builder().id(executionId).build()).id("start"));

// already finished execution
Execution execution = null;
Execution execution;
try {
execution = Await.until(
() -> executionRepository.findById(tenantService.resolveTenant(), executionId).orElse(null),
Expand Down
Loading