lock-smith 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/locksmith/config.rb +10 -2
- data/lib/locksmith/dynamodb.rb +3 -3
- metadata +1 -1
data/lib/locksmith/config.rb
CHANGED
@@ -14,7 +14,15 @@ module Locksmith
|
|
14
14
|
!env(key).nil?
|
15
15
|
end
|
16
16
|
|
17
|
-
def aws_id
|
18
|
-
|
17
|
+
def aws_id
|
18
|
+
@aws_id ||= env!("AWS_ID")
|
19
|
+
end
|
20
|
+
|
21
|
+
def aws_secret
|
22
|
+
@aws_secret ||= env!("AWS_SECRET")
|
23
|
+
end
|
24
|
+
|
25
|
+
def aws_id=(value); @aws_id = value; end
|
26
|
+
def aws_secret=(value); @aws_secret = value; end
|
19
27
|
end
|
20
28
|
end
|
data/lib/locksmith/dynamodb.rb
CHANGED
@@ -17,10 +17,10 @@ module Locksmith
|
|
17
17
|
# Clean up expired locks. Does not grantee that we will
|
18
18
|
# be able to acquire the lock, just a nice thing to do for
|
19
19
|
# the other processes attempting to lock.
|
20
|
-
|
20
|
+
delete(name) if expired?(name, opts[:ttl])
|
21
21
|
if create(name, opts[:attempts])
|
22
22
|
begin Timeout::timeout(opts[:ttl]) {return(yield)}
|
23
|
-
ensure
|
23
|
+
ensure delete(name)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -37,7 +37,7 @@ module Locksmith
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
40
|
+
def delete(name)
|
41
41
|
locks.at(name).delete
|
42
42
|
end
|
43
43
|
|