Sha256: 706920a30863821c47cfe0742a5725ebf29faf62ed3eb68bb063d1e7f087c9f1
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
local function find_digest_in_process_set(digest, threshold) local process_cursor = 0 local job_cursor = 0 local pattern = "*" .. digest .. "*" local found = false log_debug("Searching in process list", "for digest:", digest, "cursor:", process_cursor) repeat local process_paginator = redis.call("SSCAN", "processes", process_cursor, "MATCH", "*") local next_process_cursor = process_paginator[1] local processes = process_paginator[2] log_debug("Found number of processes:", #processes, "next cursor:", next_process_cursor) for _, process in ipairs(processes) do local workers_key = process .. ":workers" log_debug("searching in process set:", process, "for digest:", digest, "cursor:", process_cursor) local jobs = redis.call("HGETALL", workers_key) if #jobs == 0 then log_debug("No entries in:", workers_key) else for i = 1, #jobs, 2 do local jobstr = jobs[i +1] if string.find(jobstr, digest) then log_debug("Found digest", digest, "in:", workers_key) found = true break end local job = cjson.decode(jobstr) if job.created_at > threshold then found = true break end end end if found == true then break end end process_cursor = next_process_cursor until found == true or process_cursor == "0" return found end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-unique-jobs-7.0.1 | lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_process_set.lua |
sidekiq-unique-jobs-7.0.0 | lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_process_set.lua |