lib/deepstream/ack_timeout_registry.rb in deepstream-0.3.2 vs lib/deepstream/ack_timeout_registry.rb in deepstream-1.0.0
- old
+ new
@@ -5,13 +5,17 @@
@timeouts = {}
end
def add(name, message)
return unless (timeout = @client.options[:ack_timeout])
- @timeouts[name] = Celluloid.after(timeout) { @client.on_error(message) }
+ @timeouts[name] = Thread.new do
+ sleep timeout
+ @client.on_error(message)
+ end
end
def cancel(name)
- @timeouts.delete(name)&.cancel
+ @timeouts[name].exit rescue nil
+ @timeouts.delete(name)
end
end
end