Skip to content
2 changes: 1 addition & 1 deletion react_on_rails_pro/lib/react_on_rails_pro/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def connection_without_retries
def perform_request(path, **post_options) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
# For streaming requests, use connection without retries to prevent body duplication
# The StreamRequest class handles retries properly by starting fresh requests
conn = post_options[:stream] ? connection_without_retries : connection
conn = connection
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Restore non-retrying connection for streaming.

Switching streaming requests to the retry-enabled pool reintroduces the body duplication bug called out just above (Lines 100-101, plus the note referencing issue #1895). We still need connection_without_retries when post_options[:stream] is true; otherwise retries can replay partial stream bodies and break clients. Please keep the conditional selection so streaming uses the non-retry pool.

-        conn = connection
+        conn = post_options[:stream] ? connection_without_retries : connection
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
conn = connection
conn = post_options[:stream] ? connection_without_retries : connection
🤖 Prompt for AI Agents
In react_on_rails_pro/lib/react_on_rails_pro/request.rb around line 102, restore
the conditional so streaming requests use the non-retrying connection: set conn
= connection_without_retries when post_options[:stream] is true, otherwise set
conn = connection; ensure the conditional branch covers only the stream case and
leaves non-stream requests using the retry-enabled pool.


available_retries = ReactOnRailsPro.configuration.renderer_request_retry_limit
retry_request = true
Expand Down
Loading