Skip to content

Commit

Permalink
Release 4.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed May 1, 2020
1 parent 5694b00 commit 46e95a4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Unreleased

# 4.1.4

* Alias `Redis#disconnect` as `#close`. See #901.
* Handle clusters with multiple slot ranges. See #894.
* Fix password authentication to a redis cluster. See #889.
* Handle recursive MOVED responses. See #882.
* Increase buffer size in the ruby connector. See #880.
* Fix thread safety of `Redis.queue`. See #878.
* Deprecate `Redis::Future#==` as it's likely to be a mistake. See #876.

# 4.1.3

* Fix the client hanging forever when connecting with SSL to a non-SSL server. See #835.
Expand Down
5 changes: 0 additions & 5 deletions lib/redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
require_relative "redis/errors"

class Redis

def self.deprecate(message, trace = caller[0])
$stderr.puts "\n#{message} (in #{trace})"
end

def self.current
@current ||= Redis.new
end
Expand Down
13 changes: 10 additions & 3 deletions lib/redis/pipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,17 @@ def initialize(command, transformation, timeout)
@object = FutureNotReady
end

def ==(*)
message = "The method == and != is deprecated for Redis::Future and will be removed in 4.2.0"
def ==(_other)
message = +"The methods == and != are deprecated for Redis::Future and will be removed in 4.2.0"
message << " - You probably meant to call .value == or .value !="
::Redis.deprecate(message)
message << " (#{::Kernel.caller(1, 1).first})\n"

if defined?(::Warning)
::Warning.warn(message)
else
$stderr.puts(message)
end

super
end

Expand Down
2 changes: 1 addition & 1 deletion lib/redis/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
class Redis
VERSION = '4.1.3'
VERSION = '4.1.4'
end
10 changes: 10 additions & 0 deletions test/pipelining_commands_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ def test_futures_raise_when_command_errors_and_needs_transformation
end
end

def test_futures_warn_when_tested_for_equality
r.pipelined do
@result = r.sadd("foo", 1)
end

assert_output(nil, /deprecated/) do
@result == @result
end
end

def test_futures_can_be_identified
r.pipelined do
@result = r.sadd("foo", 1)
Expand Down

0 comments on commit 46e95a4

Please sign in to comment.