Gracefully drain SSE stream before shutdown by kvz · Pull Request #97 · transloadit/java-sdk · GitHub
Skip to content

Gracefully drain SSE stream before shutdown#97

Merged
kvz merged 4 commits into
mainfrom
fix/drain-sse-finish
Oct 27, 2025
Merged

Gracefully drain SSE stream before shutdown#97
kvz merged 4 commits into
mainfrom
fix/drain-sse-finish

Conversation

@kvz

@kvz kvz commented Oct 27, 2025

Copy link
Copy Markdown
Member

Summary

  • keep the EventSource loop alive until all events are drained and the connection shuts down cleanly
  • stop reconnection attempts once assembly_finished arrives so that result events are not replayed
  • guard post-finish errors by exiting the loop and closing the stream on faults

Testing

  • ./scripts/test-in-docker.sh check

@codecov-commenter

codecov-commenter commented Oct 27, 2025

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +179 to +206
protected void handleFaultEvent(FaultEvent faultEvent) {
if (assemblyFinished) {
shutdownEventSource();
}
stopRequested = true;
shutdownEventSource();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Abort SSE on any fault

The new handleFaultEvent now unconditionally sets stopRequested and shuts down the EventSource whenever a FaultEvent arrives. Before this change, faults were ignored unless the assembly was already finished, allowing the LaunchDarkly client to reconnect transparently. With the new logic, any transient network hiccup before assembly_finished will stop the SSE loop permanently without notifying the listener, so the assembly listener may never receive either onAssemblyFinished or onError. This prematurely terminates monitoring of long‑running assemblies in unreliable network conditions.

Useful? React with 👍 / 👎.

@kvz

kvz commented Oct 27, 2025

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

@kvz kvz merged commit d7bb207 into main Oct 27, 2025
2 checks passed
@kvz kvz deleted the fix/drain-sse-finish branch October 27, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants