File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
react_on_rails_pro/lib/react_on_rails_pro/concerns Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,9 @@ def stream_view_containing_react_components(template:, close_stream_at_end: true
5050
5151 begin
5252 drain_streams_concurrently ( parent_task )
53- ensure
53+ # Do not close the response stream in an ensure block.
54+ # If an error occurs we may need the stream open to send diagnostic/error details
55+ # (for example, ApplicationController#rescue_from in the dummy app).
5456 response . stream . close if close_stream_at_end
5557 end
5658 end
@@ -67,8 +69,13 @@ def drain_streams_concurrently(parent_task)
6769 end
6870
6971 # Wait for all component streaming tasks to complete
70- @async_barrier . wait
71-
72+ begin
73+ @async_barrier . wait
74+ rescue StandardError => e
75+ @async_barrier . stop
76+ raise e
77+ end
78+ ensure
7279 # Close the queue to signal end of streaming
7380 @main_output_queue . close
7481 writing_task . wait
You can’t perform that action at this time.
0 commit comments