Closed acegilz closed 9 years ago
The tagline of redis-mutex is "distributed mutex using Redis" - a lock is a singularity no matter what, between competing controllers / processes / servers, as long as the lock is kept as a Redis key. So, yes.
yes, it will lock on paralel processing; or yes, parallel will be possible without lock error?
If you don't want to mutex work_1
and work_2
and want to allow them to run in parallel, then you should give them different keys. Like, RedisMutex.with_lock("work_1:#{user.id}")
and RedisMutex.with_lock("work_2:#{user.id}")
.
I want them not to work in parallel. So I assune its fine as it is :)
thanks for response!
If i have 2 separated lock block instances with same user as locking param, will it be able to run simultaneously without problem or will it cause "couldn't lock record" error? I know it will cause lock error if it tries simultaneously on the same block with same params, but does it also applies if run on 2 different places ( example: one from controller x and other on controller z)?
On this example if work_1 is already running, what will happen if work_2 is called with lock on same user? Will return lock error right? Or because it is another block that still has no lock on that user it will proceed in parallel?