Sha256: d389651fb37ee7ea8eb69f3f6087a5634627519f20b776f1e20d1fd53e5dc5d5

Contents?: true

Size: 631 Bytes

Versions: 98

Compression:

Stored size: 631 Bytes

Contents

local function find_digest_in_sorted_set(name, digest)
  local cursor  = 0
  local count   = 5
  local pattern = "*" .. digest .. "*"
  local found   = false

  log_debug("searching in:", name,
            "for digest:", digest,
            "cursor:", cursor)
  repeat
    local pagination  = redis.call("ZSCAN", name, cursor, "MATCH", pattern, "COUNT", count)
    local next_cursor = pagination[1]
    local items       = pagination[2]

    if #items > 0 then
      log_debug("Found digest", digest, "in zset:", name)
      found = true
    end

    cursor = next_cursor
  until found == true or cursor == "0"

  return found
end

Version data entries

98 entries across 85 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-8.0.10 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-7.1.33 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-7.1.32 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-8.0.9 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-8.0.8 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-8.0.7 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-8.0.6 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-7.1.31 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-8.0.5 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-8.0.4 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-7.1.30 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-8.0.3 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-8.0.2 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-8.0.1 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-8.0.0 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-7.1.29 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-7.1.28 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-7.1.27 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-7.1.26 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua
sidekiq-unique-jobs-7.1.25 lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_sorted_set.lua