Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deadlocks, small improvements #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mediaslave24
Copy link

Fix deadlocks from #18.
Initialize redis after use_local_time, because use_local_time is incorrect option for redis client.
Use Enumerable#find in #locked? method for shorter code and don't shadow outer "token" variable.
Don't depend on calls to another methods in #create! (set the value right here).

@@ -211,7 +228,7 @@
end

it "without time support should return the same time as frozen time" do
expect(@redis).to receive(:time).and_raise(Redis::CommandError)
expect(semaphore.instance_variable_get(:@redis)).to receive(:time).and_raise(Redis::CommandError)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [103/80]

@@ -211,7 +228,8 @@
end

it "without time support should return the same time as frozen time" do
expect(@redis).to receive(:time).and_raise(Redis::CommandError)
expect(semaphore.instance_variable_get(:@redis)).to receive(:time)
.and_raise(Redis::CommandError)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Place the . on the previous line, together with the method call receiver.

@dv
Copy link
Owner

dv commented Jun 21, 2015

Hey @mediaslave24 thanks for contributing. However I found some problems with your code. Could you go through my comments and update, then I'll merge. Thanks!

@dv dv added the needs work label Jan 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants