You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a method that may or may not need to lock based on a few conditions. I've tried moving all of that logic to a separate method which takes a few arguments. I can call that method directly with no problem, however, I'm unable to turn that method into a block to call lock! since the method takes args. If that's possible, I'd love to hear how.
But I was curious about the resource key. If that were to be conditionally set, either to a unique string or empty string/nil/etc. What would the behavior be? Would it lock on the unique string and not acquire a lock for the empty (which would be ideal). Or would there still be an acquired lock for ''.
Thanks for any insight you can provide.
Example:
classJobClassdefperformifsome_value == some_other_valuereturnlock!('resource_key',ttl: 2000)do# How can I pass `run_job` with the args it needs to this blockendend# This is the easy case (calling the run method directly)run_job(ActiveRecordInstance,'',0)enddefrun_job(object,string,number)# critical code hereendend
The text was updated successfully, but these errors were encountered:
Hi there,
I have a method that may or may not need to lock based on a few conditions. I've tried moving all of that logic to a separate method which takes a few arguments. I can call that method directly with no problem, however, I'm unable to turn that method into a block to call
lock!
since the method takes args. If that's possible, I'd love to hear how.But I was curious about the resource key. If that were to be conditionally set, either to a unique string or empty string/nil/etc. What would the behavior be? Would it lock on the unique string and not acquire a lock for the empty (which would be ideal). Or would there still be an acquired lock for
''
.Thanks for any insight you can provide.
Example:
The text was updated successfully, but these errors were encountered: