resque-uniq 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +7 -0
- data/README.md +3 -4
- data/lib/resque/plugins/unique_job.rb +8 -4
- data/lib/resque-uniq/version.rb +1 -1
- metadata +24 -38
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -52,13 +52,12 @@ You can tell _resque-uniq_ to auto-expire job locks by setting `@unique_lock_aut
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
|
55
|
+
Lock autoexpiration was necessary to protect against stale locks. With the new run lock trick you probably don't need it anymore.
|
56
56
|
|
57
57
|
## Credits
|
58
58
|
|
59
|
-
There are several similar Resque plugins. We tried them all but for one reason or another they
|
60
|
-
for us.
|
61
|
-
of those plugins for inspiration.
|
59
|
+
There are several similar Resque plugins. We tried them all but for one reason or another they didn't work reliably
|
60
|
+
for us. Therefore we wrote our own version. Nonetheless we would like to thank the authors of those plugins for inspiration.
|
62
61
|
|
63
62
|
## Contributing
|
64
63
|
|
@@ -27,10 +27,14 @@ module Resque
|
|
27
27
|
return false unless Resque.redis.get(rlock)
|
28
28
|
|
29
29
|
Resque.working.map {|w| w.job }.map do |item|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
begin
|
31
|
+
payload = item['payload']
|
32
|
+
klass = Resque::Job.constantize(payload['class'])
|
33
|
+
args = payload['args']
|
34
|
+
return false if rlock == klass.run_lock(*args)
|
35
|
+
rescue NameError
|
36
|
+
# unknown job class, ignore
|
37
|
+
end
|
34
38
|
end
|
35
39
|
true
|
36
40
|
end
|
data/lib/resque-uniq/version.rb
CHANGED
metadata
CHANGED
@@ -1,34 +1,25 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-uniq
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 4
|
10
|
-
version: 0.0.4
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Trung Duc Tran
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2012-07-22 00:00:00 Z
|
12
|
+
date: 2012-09-01 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
14
|
description:
|
22
|
-
email:
|
15
|
+
email:
|
23
16
|
- trung@tdtran.org
|
24
17
|
executables: []
|
25
|
-
|
26
18
|
extensions: []
|
27
|
-
|
28
19
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
20
|
+
files:
|
31
21
|
- .gitignore
|
22
|
+
- .travis.yml
|
32
23
|
- Gemfile
|
33
24
|
- LICENSE
|
34
25
|
- README.md
|
@@ -40,36 +31,31 @@ files:
|
|
40
31
|
- test/unique_job_test.rb
|
41
32
|
homepage: http://github.com/tdtran/resque-uniq
|
42
33
|
licenses: []
|
43
|
-
|
44
34
|
post_install_message:
|
45
35
|
rdoc_options: []
|
46
|
-
|
47
|
-
require_paths:
|
36
|
+
require_paths:
|
48
37
|
- lib
|
49
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
39
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
segments:
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
segments:
|
56
45
|
- 0
|
57
|
-
|
58
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
hash: 563217245005310137
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
48
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
segments:
|
65
|
-
- 0
|
66
|
-
version: "0"
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
67
53
|
requirements: []
|
68
|
-
|
69
54
|
rubyforge_project:
|
70
55
|
rubygems_version: 1.8.24
|
71
56
|
signing_key:
|
72
57
|
specification_version: 3
|
73
|
-
summary: A Resque plugin to ensure only one job instance is queued or running at a
|
74
|
-
|
58
|
+
summary: A Resque plugin to ensure only one job instance is queued or running at a
|
59
|
+
time.
|
60
|
+
test_files:
|
75
61
|
- test/unique_job_test.rb
|