lib/submodules/ably-ruby/lib/ably/realtime/channel/channel_manager.rb in ably-rest-1.0.6 vs lib/submodules/ably-ruby/lib/ably/realtime/channel/channel_manager.rb in ably-rest-1.1.0
- old
+ new
@@ -109,20 +109,16 @@
else
EventMachine.add_timer(0.1) { fail_proc.call }
end
end
- # When a channel becomes detached, suspended or failed,
+ # When a channel becomes suspended or failed,
# all queued messages should be failed immediately as we don't queue in
# any of those states
def fail_queued_messages(error)
error = Ably::Exceptions::MessageDeliveryFailed.new("Queued messages on channel '#{channel.name}' in state '#{channel.state}' will never be delivered") unless error
fail_messages_in_queue connection.__outgoing_message_queue__, error
- channel.__queue__.each do |message|
- nack_message message, error
- end
- channel.__queue__.clear
end
def fail_messages_in_queue(queue, error)
queue.delete_if do |protocol_message|
if protocol_message.action.match_any?(:presence, :message)
@@ -212,10 +208,10 @@
def send_state_change_protocol_message(new_state, state_if_failed)
state_at_time_of_request = channel.state
@pending_state_change_timer = EventMachine::Timer.new(realtime_request_timeout) do
if channel.state == state_at_time_of_request
- error = Ably::Models::ErrorInfo.new(code: 90007, message: "Channel #{new_state} operation failed (timed out)")
+ error = Ably::Models::ErrorInfo.new(code: Ably::Exceptions::Codes::CHANNEL_OPERATION_FAILED_NO_RESPONSE_FROM_SERVER, message: "Channel #{new_state} operation failed (timed out)")
channel.transition_state_machine state_if_failed, reason: error
end
end
channel.once_state_changed do