Skip to content

Commit

Permalink
Make sure to flush output stream before writing the worker response
Browse files Browse the repository at this point in the history
  • Loading branch information
jjudd committed Nov 12, 2024
1 parent 4001ea6 commit 1ce90c3
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ abstract class WorkerMain[S](stdin: InputStream = System.in, stdout: PrintStream
e.getCause() match {
// Task successfully cancelled
case cancelError: InterruptedException =>
out.flush()
writeResponse(requestId, None, None, wasCancelled = true)
logVerbose(
s"Cancellation WorkResponse sent for request id: $requestId in response to an" +
Expand All @@ -165,6 +166,7 @@ abstract class WorkerMain[S](stdin: InputStream = System.in, stdout: PrintStream

// Task successfully cancelled
case Failure(e: CancellationException) =>
out.flush()
writeResponse(requestId, None, None, wasCancelled = true)
logVerbose(
s"Cancellation WorkResponse sent for request id: $requestId in response to a" +
Expand Down

0 comments on commit 1ce90c3

Please sign in to comment.