lib/redis/connection/synchrony.rb in redis-4.1.4 vs lib/redis/connection/synchrony.rb in redis-4.2.0
- old
+ new
@@ -1,12 +1,18 @@
# frozen_string_literal: true
+
require_relative "command_helper"
require_relative "registry"
require_relative "../errors"
require "em-synchrony"
require "hiredis/reader"
+Kernel.warn(
+ "The redis synchrony driver is deprecated and will be removed in redis-rb 5.0. " \
+ "We're looking for people to maintain it as a separate gem, see https://github.com/redis/redis-rb/issues/915"
+)
+
class Redis
module Connection
class RedisClient < EventMachine::Connection
include EventMachine::Deferrable
@@ -45,13 +51,11 @@
end
end
def read
@req = EventMachine::DefaultDeferrable.new
- if @timeout > 0
- @req.timeout(@timeout, :timeout)
- end
+ @req.timeout(@timeout, :timeout) if @timeout > 0
EventMachine::Synchrony.sync @req
end
def send(data)
callback { send_data data }
@@ -104,10 +108,10 @@
def initialize(connection)
@connection = connection
end
def connected?
- @connection && @connection.connected?
+ @connection&.connected?
end
def timeout=(timeout)
@connection.timeout = timeout
end