-- lua/claim_job.lua
-- Atomically claim a job from waiting queue and move to active.
-- Job metadata is updated in Rust (single JSON field) after this script returns.
-- KEYS[1] = wait_key
-- KEYS[2] = active_key
local wait_key = KEYS
local active_key = KEYS
local job_id = redis.
if not job_id
redis.
return job_id