mirror of
https://github.com/chatwoot/chatwoot.git
synced 2026-06-04 21:02:35 +08:00
docs: document mutex lock ownership caveat
This commit is contained in:
parent
7066473e93
commit
faca9cacde
@ -22,6 +22,11 @@ class MutexApplicationJob < ApplicationJob
|
||||
end
|
||||
end
|
||||
|
||||
# Redis::LockManager#unlock is not owner-checked. If a job runs past the TTL,
|
||||
# Redis can expire the key, a newer job can acquire it, and the older job can
|
||||
# then delete the newer job's lock on unlock. Current mutex users treat locks as
|
||||
# short race dampeners, so this is acceptable for now. Future iterations should
|
||||
# move Redis::LockManager to token-checked unlocks.
|
||||
def with_lock(lock_key, timeout = Redis::LockManager::LOCK_TIMEOUT)
|
||||
lock_manager = Redis::LockManager.new
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user