Sha256: a96608be569de97fa0ef43de5c8dc3c3a54c2b5656c2623af306ad2e5239bcd8

Contents?: true

Size: 460 Bytes

Versions: 10

Compression:

Stored size: 460 Bytes

Contents

local function delete_from_sorted_set(name, digest)
  local per   = 50
  local total = redis.call("zcard", name)
  local index = 0
  local result

  while (index < total) do
    local items = redis.call("ZRANGE", name, index, index + per -1)
    for _, item in pairs(items) do
      if string.find(item, digest) then
        redis.call("ZREM", name, item)
        result = item
        break
      end
    end
    index = index + per
  end
  return result
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-8.0.9 lib/sidekiq_unique_jobs/lua/shared/_delete_from_sorted_set.lua
sidekiq-unique-jobs-8.0.8 lib/sidekiq_unique_jobs/lua/shared/_delete_from_sorted_set.lua
sidekiq-unique-jobs-8.0.7 lib/sidekiq_unique_jobs/lua/shared/_delete_from_sorted_set.lua
sidekiq-unique-jobs-8.0.6 lib/sidekiq_unique_jobs/lua/shared/_delete_from_sorted_set.lua
sidekiq-unique-jobs-8.0.5 lib/sidekiq_unique_jobs/lua/shared/_delete_from_sorted_set.lua
sidekiq-unique-jobs-8.0.4 lib/sidekiq_unique_jobs/lua/shared/_delete_from_sorted_set.lua
sidekiq-unique-jobs-8.0.3 lib/sidekiq_unique_jobs/lua/shared/_delete_from_sorted_set.lua
sidekiq-unique-jobs-8.0.2 lib/sidekiq_unique_jobs/lua/shared/_delete_from_sorted_set.lua
sidekiq-unique-jobs-8.0.1 lib/sidekiq_unique_jobs/lua/shared/_delete_from_sorted_set.lua
sidekiq-unique-jobs-8.0.0 lib/sidekiq_unique_jobs/lua/shared/_delete_from_sorted_set.lua