Skip to content

Commit

Permalink
Add active support (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaicolBen authored Nov 19, 2019
1 parent cd2596d commit c148054
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ source 'https://rubygems.org'

# Specify your gem's dependencies in simple-redis-lock.gemspec
gemspec

gem 'activesupport'
4 changes: 3 additions & 1 deletion lib/simple_redis_lock/redis_lock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

LockError = Class.new(StandardError)

require 'active_support/core_ext/numeric/time'

module SimpleRedisLock
class RedisLock
DEFAULT_RETRY_COUNT = 25
# DEFAULT_TTL = 5.seconds # TODO: add active support?
DEFAULT_TTL = 5.seconds
UNLOCK_SCRIPT = <<~LUA
if redis.call("get",KEYS[1]) == ARGV[1] then
return redis.call("del",KEYS[1])
Expand Down

0 comments on commit c148054

Please sign in to comment.