lock_key 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/lock_key/lock_key.rb +3 -2
- data/lib/lock_key/version.rb +1 -1
- metadata +1 -1
data/lib/lock_key/lock_key.rb
CHANGED
@@ -130,13 +130,14 @@ class Redis
|
|
130
130
|
_value_ = lock_value_for(key,opts)
|
131
131
|
new_lock = _redis_.getset(_key_, _value_)
|
132
132
|
got_lock = new_lock if i_have_the_lock?(new_lock)
|
133
|
+
elsif i_have_the_lock?(current_lock)
|
134
|
+
got_lock = current_lock
|
133
135
|
end
|
134
136
|
sleep opts[:sleep_for]
|
135
137
|
end
|
136
138
|
|
137
139
|
if !got_lock && opts[:raise]
|
138
|
-
|
139
|
-
raise LockAttemptTimeout, "Could not lock #{_value_}"
|
140
|
+
raise LockAttemptTimeout, "Could not lock #{key}"
|
140
141
|
end
|
141
142
|
|
142
143
|
got_lock
|
data/lib/lock_key/version.rb
CHANGED