Documentation taken from here

How to recreate
class UpdateUserJob < ActiveJob::Base
include ActiveJobLock::Core
lock loner: true
def perform(user)
user.update_something_important
end
end
Enqueue Job:
user = User.first
puts user.to_s
=> "#<User:0x00007f9101f10c90>"
UpdateUserJob.perform_later(user)
Check locks:
redis-cli KEYS "loner:lock:UpdateUserJob:*"
loner:lock:UpdateUserJob:#<User:0x00007f9101f10c90>
Wait for job to be processed by workers...
Check locks:
redis-cli KEYS "loner:lock:UpdateUserJob:*"
loner:lock:UpdateUserJob:#<User:0x00007f9101f10c90>
Problem
redis_loner_lock_key generates different keys when called from enqueue and perform when relying on GlobalId to pass ActiveRecord objects as parameters, which causes Redis to be polluted.
Documentation taken from here
How to recreate
Enqueue Job:
Check locks:
Wait for job to be processed by workers...
Check locks:
Problem
redis_loner_lock_keygenerates different keys when called fromenqueueandperformwhen relying on GlobalId to pass ActiveRecord objects as parameters, which causes Redis to be polluted.