We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 54a1c66 commit 19d6f11Copy full SHA for 19d6f11
lib/redis/semaphore.rb
@@ -94,11 +94,7 @@ def locked?(token = nil)
94
if token
95
@redis.hexists(grabbed_key, token)
96
else
97
- @tokens.each do |token|
98
- return true if locked?(token)
99
- end
100
-
101
- false
+ @tokens.any? { |t| locked?(t) }
102
end
103
104
spec/semaphore_spec.rb
@@ -228,7 +228,8 @@
228
229
230
it "without time support should return the same time as frozen time" do
231
- expect(semaphore.instance_variable_get(:@redis)).to receive(:time).and_raise(Redis::CommandError)
+ expect(semaphore.instance_variable_get(:@redis)).to receive(:time)
232
+ .and_raise(Redis::CommandError)
233
expect(semaphore.send(:current_time)).to eq(Time.now)
234
235
0 commit comments