locker 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +9 -4
- data/Gemfile +2 -0
- data/Gemfile_rails_3 +2 -0
- data/Gemfile_rails_4 +2 -0
- data/lib/locker/locker.rb +5 -0
- data/lib/locker/version.rb +1 -1
- data/locker.gemspec +2 -0
- data/spec/locker/locker_spec.rb +15 -0
- data/spec/spec_helper.rb +7 -0
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ddf2a9f70dca510ad4dc728ce283dde0102e9a2
|
4
|
+
data.tar.gz: 5c7d2bfa20e1642815fed9ffab42d2f7ed9b982f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4ffe8ab76a4396b98292862e87837b82dd969aae85e55b02f3eab4cc0af582a95758dbc229dd027d38fd654539c1062ae7c868ab9fd791262585ee37459c836
|
7
|
+
data.tar.gz: e2185e9144a35d2fcf6206d4fbf546cc73f0443e0531a78f2310b1d8aea6eaee64a9422c271187d11315e69cee1228c4b6ed05a87310d4aa64e0e98095ee6e17
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -3,8 +3,13 @@ gemfile:
|
|
3
3
|
- Gemfile_rails_3
|
4
4
|
- Gemfile_rails_4
|
5
5
|
rvm:
|
6
|
-
- ruby-2.1.
|
7
|
-
- ruby-2.2.
|
8
|
-
- ruby-2.3.
|
9
|
-
-
|
6
|
+
- ruby-2.1.10
|
7
|
+
- ruby-2.2.7
|
8
|
+
- ruby-2.3.4
|
9
|
+
- ruby-2.4.1
|
10
|
+
- jruby-9.1.9.0
|
10
11
|
script: bundle exec rspec
|
12
|
+
matrix:
|
13
|
+
exclude:
|
14
|
+
- rvm: ruby-2.4.1
|
15
|
+
gemfile: Gemfile_rails_3
|
data/Gemfile
CHANGED
data/Gemfile_rails_3
CHANGED
data/Gemfile_rails_4
CHANGED
data/lib/locker/locker.rb
CHANGED
data/lib/locker/version.rb
CHANGED
data/locker.gemspec
CHANGED
@@ -19,4 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_dependency "activerecord", ">=3.2", "<5"
|
20
20
|
s.add_development_dependency "pg", "~> 0"
|
21
21
|
s.add_development_dependency "rspec", "~> 3.2"
|
22
|
+
s.add_development_dependency "pry", "~> 0.10.4"
|
23
|
+
s.add_development_dependency "pry-byebug", "~> 3.4.2"
|
22
24
|
end
|
data/spec/locker/locker_spec.rb
CHANGED
@@ -144,4 +144,19 @@ describe Locker do
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
+
describe "pruning" do
|
148
|
+
it "deletes old locks" do
|
149
|
+
l1 = Lock.create!(:key => "key1", :locked_until => 2.minutes.ago)
|
150
|
+
l2 = Lock.create!(:key => "key2", :locked_until => 4.minutes.ago)
|
151
|
+
l3 = Lock.create!(:key => "key3", :locked_until => 6.minutes.ago)
|
152
|
+
l4 = Lock.create!(:key => "key4", :locked_until => 8.minutes.ago)
|
153
|
+
|
154
|
+
Locker.prune(5.minutes.ago)
|
155
|
+
|
156
|
+
expect( Lock.where(:key => "key1").first ).to_not be_nil
|
157
|
+
expect( Lock.where(:key => "key2").first ).to_not be_nil
|
158
|
+
expect( Lock.where(:key => "key3").first ).to be_nil
|
159
|
+
expect( Lock.where(:key => "key3").first ).to be_nil
|
160
|
+
end
|
161
|
+
end
|
147
162
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,13 @@ require 'rubygems'
|
|
5
5
|
require 'bundler/setup'
|
6
6
|
require 'active_record'
|
7
7
|
|
8
|
+
begin
|
9
|
+
require 'pry'
|
10
|
+
require 'pry-byebug'
|
11
|
+
rescue LoadError
|
12
|
+
# jruby won't have these
|
13
|
+
end
|
14
|
+
|
8
15
|
require 'locker'
|
9
16
|
|
10
17
|
ActiveRecord::Base.time_zone_aware_attributes = true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Sutton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-08-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -59,6 +59,34 @@ dependencies:
|
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.2'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: pry
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.10.4
|
69
|
+
type: :development
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.10.4
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: pry-byebug
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.4.2
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.4.2
|
62
90
|
description: Locker is a locking mechanism for limiting the concurrency of ruby code
|
63
91
|
using the database. It presently only works with PostgreSQL.
|
64
92
|
email:
|