Sha256: ceeb4f2d5f57b6d5949d46122ce6d53818d5069b9f5839ea8cb1ac5cd8fa0f5f

Contents?: true

Size: 514 Bytes

Versions: 63

Compression:

Stored size: 514 Bytes

Contents

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

  while (index < total) 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)
        result = item
        break
      end
    end
    index = index + per
  end
  return result
end

Version data entries

63 entries across 63 versions & 1 rubygems

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