Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/redis/semaphore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Semaphore

# stale_client_timeout is the threshold of time before we assume
# that something has gone terribly wrong with a client and we
# invalidate it's lock.
# invalidate its lock.
# Default is nil for which we don't check for stale clients
# Redis::Semaphore.new(:my_semaphore, :stale_client_timeout => 30, :redis => myRedis)
# Redis::Semaphore.new(:my_semaphore, :redis => myRedis)
Expand Down Expand Up @@ -81,6 +81,7 @@ def lock(timeout = nil)
end
end

set_expiration_if_necessary
return_value
end
alias_method :wait, :lock
Expand Down Expand Up @@ -199,7 +200,7 @@ def create!

def set_expiration_if_necessary
if @expiration
[available_key, exists_key, version_key].each do |key|
[available_key, exists_key, version_key, @stale_client_timeout.nil?? grabbed_key : nil ].each do |key|
Copy link
Collaborator

Choose a reason for hiding this comment

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

Surrounding space missing for operator ?.
Line is too long. [110/80]
Space inside square brackets detected.

@redis.expire(key, @expiration)
end
end
Expand Down
2 changes: 1 addition & 1 deletion redis-semaphore.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'redis-semaphore'
s.version = '0.3.1'
s.version = '0.4.0'
s.summary = 'Implements a distributed semaphore or mutex using Redis.'
s.authors = ['David Verhasselt']
s.email = 'david@crowdway.com'
Expand Down