"lib/em-hiredis/client.rb":

    def eval_script(lua, lua_sha, keys, args)
      df = EM::DefaultDeferrable.new
      method_missing(:evalsha, lua_sha, keys.size, *keys, *args).callback(
        &df.method(:succeed)
      ).errback { |e|
        if e.kind_of?(RedisError) && 
e.redis_error.message.start_with?("NOSCRIPT")
          self.eval(lua, keys.size, *keys, *args)
            .callback(&df.method(:succeed)).errback(&df.method(:fail))
        else
          df.fail(e)
        end
      }
      df
    end  


whenever evalsha method is not available, self.eval(lua, keys.size, *keys, 
*args) complains about the number of variables being given to self.eval(). It 
is likely that the method definition (self) has changed among ruby versions. 
The arguments seem fine, example:

lua =

-- Set key to token with expiry of timeout, if:
--  - It doesn't exist
--  - It exists and already has value of token (further set extends timeout)
-- Used to implement a re-entrant lock.
local key = KEYS[1]
local token = ARGV[1]
local timeout = ARGV[2]

local value = redis.call('get', key)

if value == token or not value then
    -- Great, either we hold the lock or it's free for us to take
    return redis.call('setex', key, timeout, token)
else
    -- Someone else has it
    return false
end

lua_sha = 32d8d2000576c02c167c899979858c886d4524aa
keys = ["test-lock"]
args= ["b978de50e36126d49314bbcec2ccc76e", 2]

** Changed in: ruby-em-hiredis (Ubuntu)
       Status: New => Confirmed

** Changed in: ruby-em-hiredis (Ubuntu)
     Assignee: (unassigned) => Lucas Kanashiro (lucaskanashiro)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1866884

Title:
  Autopkgtest regression trigerred by Ruby 2.7

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ruby-em-hiredis/+bug/1866884/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to