Skip to content

Commit

Permalink
Refactored request_attach method to include reason as param
Browse files Browse the repository at this point in the history
  • Loading branch information
sacOO7 committed Jul 3, 2024
1 parent 8f6a1b0 commit ce628e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions lib/ably/realtime/channel/channel_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ def log_channel_error(error)
end

# Request channel to be reattached by sending an attach protocol message
# @param [Hash] options
# @param reason
# @option options [Ably::Models::ErrorInfo] :reason
def request_reattach(options = {})
reason = options[:reason]
def request_reattach(reason = nil)
send_attach_protocol_message
logger.debug { "Explicit channel reattach request sent to Ably due to #{reason}" }
channel.set_channel_error_reason(reason) if reason
Expand Down
2 changes: 1 addition & 1 deletion lib/ably/realtime/connection/connection_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def force_reattach_on_channels(error)
channels.select do |channel|
channel.attached? || channel.attaching? || channel.suspended?
end.each do |channel|
channel.manager.request_reattach reason: error
channel.manager.request_reattach error
end
end

Expand Down

0 comments on commit ce628e7

Please sign in to comment.