Sha256: 4c1bcf1d0b59b36d67e28af3655c545b5c68366ad2cb0208cfc6edfb54fe1c57

Contents?: true

Size: 438 Bytes

Versions: 1

Compression:

Stored size: 438 Bytes

Contents

local function delete_from_queue(queue, digest)
  local total = redis.call("LLEN", queue)
  local per   = 50

  for index = 0, total, per do
    local items = redis.call("LRANGE", queue, index, index + per - 1)

    if #items == 0 then
      break
    end

    for _, item in pairs(items) do
      if string.find(item, digest) then
        redis.call("LREM", queue, 1, item)

        return item
      end
    end
  end

  return nil
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-8.0.10 lib/sidekiq_unique_jobs/lua/shared/_delete_from_queue.lua