sidekiq-superworker 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/sidekiq/superworker.rb +2 -1
- data/lib/sidekiq/superworker/subjob.rb +6 -4
- data/lib/sidekiq/superworker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae27a81adaff0c4d2eb72b1f95dab8c5c25a7260
|
4
|
+
data.tar.gz: 187c3f3729c27a7ddfbc3019f94743e0893e9c59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1702fea0b8f47b6ff3b69875c2be6130ca4fb0b03e371b57c3e56adcbb92d207e8cf23641df213ca6e57231ac28122bc773593fd7b688805ac1635849176b35
|
7
|
+
data.tar.gz: 866911be02c68203d7b73892d8ce3a13be9046be106fc56e76b968e249b7f83bc0a1efe11be1abc93d7355364752aeef60da6989efd613e7f7c51e6c973c7209
|
data/README.md
CHANGED
@@ -136,6 +136,15 @@ When a superjob is queued, records for all of its subjobs are created. By defaul
|
|
136
136
|
Sidekiq::Superworker.options[:delete_subjobs_after_superjob_completes] = false
|
137
137
|
```
|
138
138
|
|
139
|
+
#### Superjob expiration
|
140
|
+
|
141
|
+
When a subjob dies due to too many retries, the jobs that depend on it will never run and the superjob will never be completed. Consequently, the subjob Redis keys will never be removed. You can set `superjob_expiration` to *N* to make the subjobs keys expire in *N* seconds. The default value is `nil` (the keys will never expire).
|
142
|
+
|
143
|
+
```ruby
|
144
|
+
# config/initializers/superworker.rb
|
145
|
+
Sidekiq::Superworker.options[:superjob_expiration] = 2592000 # 1 Month
|
146
|
+
```
|
147
|
+
|
139
148
|
### Logging
|
140
149
|
|
141
150
|
To make debugging easier, Sidekiq Superworker provides detailed log messages when its logger is set to the DEBUG level:
|
data/lib/sidekiq/superworker.rb
CHANGED
@@ -74,7 +74,7 @@ module Sidekiq
|
|
74
74
|
result = nil
|
75
75
|
Sidekiq.redis do |conn|
|
76
76
|
conn.multi do
|
77
|
-
result = yield
|
77
|
+
result = yield(conn)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
result
|
@@ -102,8 +102,10 @@ module Sidekiq
|
|
102
102
|
|
103
103
|
def save
|
104
104
|
return false unless self.valid?
|
105
|
-
|
105
|
+
|
106
|
+
self.class.transaction do |conn|
|
106
107
|
conn.mapped_hmset(key, to_param)
|
108
|
+
conn.expire(key,Superworker.options[:superjob_expiration]) if Superworker.options[:superjob_expiration]
|
107
109
|
end
|
108
110
|
true
|
109
111
|
end
|
@@ -140,12 +142,12 @@ module Sidekiq
|
|
140
142
|
|
141
143
|
def children
|
142
144
|
return [] if children_ids.blank?
|
143
|
-
children = children_ids.collect { |id| self.class.find_by_jid(self.class.jid(superjob_id,id)) }
|
145
|
+
children = children_ids.collect { |id| self.class.find_by_jid(self.class.jid(superjob_id, id)) }
|
144
146
|
children.reject(&:nil?)
|
145
147
|
end
|
146
148
|
|
147
149
|
def next
|
148
|
-
self.class.find_by_jid(self.class.jid(superjob_id,next_id))
|
150
|
+
self.class.find_by_jid(self.class.jid(superjob_id, next_id))
|
149
151
|
end
|
150
152
|
|
151
153
|
def ==(other)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-superworker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Benner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|