sidecloq 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/sidecloq/locker.rb +6 -1
- data/lib/sidecloq/version.rb +1 -1
- data/sidecloq.gemspec +3 -3
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b41bfb4239c49401c7770406179fa1f540b7c02f
|
4
|
+
data.tar.gz: fe0442e1e48ab22235e87730805bf66857187def
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23ac57a675494dcbd4c165e2be9926fde24705b6f0186cf5e8c72f8bb4f12f107bd1d8bab6f03e8e6346dfab67a486057ce57a0c648edf0339ea6d539c758025
|
7
|
+
data.tar.gz: ef479271fb90cebc3019de4ca86a1a3007689b2cdaba584c08a3bb25ab45a6d3d554fa101c6c24b136342def3d037dd54f4a4676ae1cfeea22bdc1586a9d3470
|
data/README.md
CHANGED
@@ -71,9 +71,17 @@ the above configuration block).
|
|
71
71
|
```yaml
|
72
72
|
my_scheduled_job: # a unique name for this schedule
|
73
73
|
class: Jobs::DoWork # the job class
|
74
|
+
args: [100] # (optional) set of arguments
|
74
75
|
cron: "* * * * *" # cron formatted schedule
|
75
76
|
queue: "queue_name" # Sidekiq queue for job
|
76
77
|
|
78
|
+
my_scheduled_job_with_args:
|
79
|
+
class: Jobs::WorkerWithArgs
|
80
|
+
args:
|
81
|
+
batch_size: 100
|
82
|
+
cron: "1 1 * * *"
|
83
|
+
queue: "queue_name"
|
84
|
+
|
77
85
|
my_other_scheduled_job:
|
78
86
|
class: Jobs::AnotherClassName
|
79
87
|
cron: "1 1 * * *"
|
data/lib/sidecloq/locker.rb
CHANGED
@@ -13,6 +13,7 @@ module Sidecloq
|
|
13
13
|
@check_interval = options[:check_interval] || 15
|
14
14
|
@lock_manager = Redlock::Client.new([@redis])
|
15
15
|
@obtained_lock = Concurrent::Event.new
|
16
|
+
@lock = nil
|
16
17
|
end
|
17
18
|
|
18
19
|
# blocks until lock is obtained, then yields
|
@@ -51,7 +52,11 @@ module Sidecloq
|
|
51
52
|
|
52
53
|
def try_to_get_or_refresh_lock
|
53
54
|
# redlock is in ms, not seconds
|
54
|
-
|
55
|
+
if @lock
|
56
|
+
@lock = @lock_manager.lock(@key, @ttl * 1000, extend: @lock)
|
57
|
+
else
|
58
|
+
@lock = @lock_manager.lock(@key, @ttl * 1000)
|
59
|
+
end
|
55
60
|
@obtained_lock.set if @lock
|
56
61
|
logger.debug("Leader lock #{'not ' unless @lock}held")
|
57
62
|
@lock
|
data/lib/sidecloq/version.rb
CHANGED
data/sidecloq.gemspec
CHANGED
@@ -20,13 +20,13 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
22
|
spec.add_dependency 'sidekiq', '>= 3.5.3', '< 5'
|
23
|
-
spec.add_dependency 'redlock', '~> 0.
|
23
|
+
spec.add_dependency 'redlock', '~> 0.2.0'
|
24
24
|
# mimics some dev dependencies of sidekiq:
|
25
25
|
spec.add_dependency 'concurrent-ruby'
|
26
26
|
spec.add_dependency 'rufus-scheduler', '~> 3.1', '>= 3.1.10'
|
27
27
|
|
28
|
-
spec.add_development_dependency 'rake', '
|
28
|
+
spec.add_development_dependency 'rake', '>= 10.0'
|
29
29
|
spec.add_development_dependency 'minitest'
|
30
|
-
spec.add_development_dependency 'redis-namespace', '~> 1.5', '>= 1.5.
|
30
|
+
spec.add_development_dependency 'redis-namespace', '~> 1.5', '>= 1.5.3'
|
31
31
|
spec.add_development_dependency 'activejob'
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidecloq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Robinson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.
|
39
|
+
version: 0.2.0
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
46
|
+
version: 0.2.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: concurrent-ruby
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,14 +82,14 @@ dependencies:
|
|
82
82
|
name: rake
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- - "
|
85
|
+
- - ">="
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '10.0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- - "
|
92
|
+
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '10.0'
|
95
95
|
- !ruby/object:Gem::Dependency
|
@@ -115,7 +115,7 @@ dependencies:
|
|
115
115
|
version: '1.5'
|
116
116
|
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: 1.5.
|
118
|
+
version: 1.5.3
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -125,7 +125,7 @@ dependencies:
|
|
125
125
|
version: '1.5'
|
126
126
|
- - ">="
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version: 1.5.
|
128
|
+
version: 1.5.3
|
129
129
|
- !ruby/object:Gem::Dependency
|
130
130
|
name: activejob
|
131
131
|
requirement: !ruby/object:Gem::Requirement
|