sidekiq-glass 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +2 -2
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +26 -16
- data/MIT-LICENCE +18 -0
- data/README.md +26 -1
- data/lib/sidekiq_glass.rb +1 -0
- data/lib/sidekiq_glass/version.rb +1 -1
- data/lib/sidekiq_glass/worker.rb +7 -0
- data/sidekiq-glass.gemspec +4 -3
- metadata +23 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2547238c39d90088776c82a14e1c18e41606943
|
4
|
+
data.tar.gz: d76098e8772b692fe35ceff4dba933d2d007a905
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4da77adb1e178496689e95a4bfa2ba5926c9acae459965cd9b3f9c7ba0fad062e20e30de557411ae168a90664abf8cfbb8ac49dd2ad63332836bf3101b392f17
|
7
|
+
data.tar.gz: 4d754f4f7d50fc06f96f767c514a98cfd5f380a259ae07908d7d4199dd54ee46e5ddf29069b22c1fc5a526e6fdfbcd3bab4fd355f9de246710a19f78e3982cee
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.3
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sidekiq-glass (0.1.
|
4
|
+
sidekiq-glass (0.1.3)
|
5
5
|
celluloid (= 0.16.0)
|
6
|
+
null-logger
|
6
7
|
sidekiq (= 3.4.1)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
12
|
abstract_type (0.0.7)
|
12
|
-
activemodel (4.2.
|
13
|
-
activesupport (= 4.2.
|
13
|
+
activemodel (4.2.4)
|
14
|
+
activesupport (= 4.2.4)
|
14
15
|
builder (~> 3.1)
|
15
|
-
activesupport (4.2.
|
16
|
+
activesupport (4.2.4)
|
16
17
|
i18n (~> 0.7)
|
17
18
|
json (~> 1.7, >= 1.7.7)
|
18
19
|
minitest (~> 5.1)
|
@@ -28,17 +29,18 @@ GEM
|
|
28
29
|
descendants_tracker (~> 0.0.4)
|
29
30
|
ice_nine (~> 0.11.0)
|
30
31
|
thread_safe (~> 0.3, >= 0.3.1)
|
31
|
-
brakeman (3.0
|
32
|
+
brakeman (3.1.0)
|
32
33
|
erubis (~> 2.6)
|
33
34
|
fastercsv (~> 1.5)
|
34
35
|
haml (>= 3.0, < 5.0)
|
35
|
-
highline (~> 1.6
|
36
|
+
highline (~> 1.6)
|
36
37
|
multi_json (~> 1.2)
|
37
|
-
ruby2ruby (
|
38
|
+
ruby2ruby (>= 2.1.1, < 2.3.0)
|
38
39
|
ruby_parser (~> 3.7.0)
|
39
40
|
sass (~> 3.0)
|
40
|
-
|
41
|
-
|
41
|
+
slim (>= 1.3.6, < 4.0)
|
42
|
+
terminal-table (~> 1.4.5)
|
43
|
+
bson (3.2.4)
|
42
44
|
builder (3.2.2)
|
43
45
|
celluloid (0.16.0)
|
44
46
|
timers (~> 4.0.0)
|
@@ -70,7 +72,7 @@ GEM
|
|
70
72
|
haml (~> 4.0)
|
71
73
|
rubocop (>= 0.25.0)
|
72
74
|
sysexits (~> 1.1)
|
73
|
-
highline (1.
|
75
|
+
highline (1.7.3)
|
74
76
|
hitimes (1.2.2)
|
75
77
|
i18n (0.7.0)
|
76
78
|
ice_nine (0.11.1)
|
@@ -93,11 +95,12 @@ GEM
|
|
93
95
|
connection_pool (~> 2.0)
|
94
96
|
optionable (~> 0.2.0)
|
95
97
|
multi_json (1.11.2)
|
98
|
+
null-logger (0.1.0)
|
96
99
|
optionable (0.2.0)
|
97
100
|
origin (2.1.1)
|
98
101
|
parser (2.2.2.6)
|
99
102
|
ast (>= 1.1, < 3.0)
|
100
|
-
polishgeeks-dev-tools (1.
|
103
|
+
polishgeeks-dev-tools (1.2.0)
|
101
104
|
brakeman
|
102
105
|
faker
|
103
106
|
haml-lint
|
@@ -138,14 +141,14 @@ GEM
|
|
138
141
|
diff-lcs (>= 1.2.0, < 2.0)
|
139
142
|
rspec-support (~> 3.3.0)
|
140
143
|
rspec-support (3.3.0)
|
141
|
-
rubocop (0.
|
144
|
+
rubocop (0.34.0)
|
142
145
|
astrolabe (~> 1.3)
|
143
146
|
parser (>= 2.2.2.5, < 3.0)
|
144
147
|
powerpack (~> 0.1)
|
145
148
|
rainbow (>= 1.99.1, < 3.0)
|
146
149
|
ruby-progressbar (~> 1.4)
|
147
150
|
ruby-progressbar (1.7.5)
|
148
|
-
ruby2ruby (2.
|
151
|
+
ruby2ruby (2.2.0)
|
149
152
|
ruby_parser (~> 3.1)
|
150
153
|
sexp_processor (~> 4.0)
|
151
154
|
ruby_parser (3.7.1)
|
@@ -157,7 +160,7 @@ GEM
|
|
157
160
|
reek (= 1.6.3)
|
158
161
|
ruby2ruby (>= 2.1.1, < 3.0)
|
159
162
|
virtus (~> 1.0)
|
160
|
-
sass (3.4.
|
163
|
+
sass (3.4.18)
|
161
164
|
sexp_processor (4.6.0)
|
162
165
|
shoulda (3.5.0)
|
163
166
|
shoulda-context (~> 1.0, >= 1.0.1)
|
@@ -176,13 +179,17 @@ GEM
|
|
176
179
|
json (~> 1.8)
|
177
180
|
simplecov-html (~> 0.10.0)
|
178
181
|
simplecov-html (0.10.0)
|
182
|
+
slim (3.0.6)
|
183
|
+
temple (~> 0.7.3)
|
184
|
+
tilt (>= 1.3.3, < 2.1)
|
179
185
|
slop (3.6.0)
|
180
186
|
sysexits (1.2.0)
|
181
|
-
|
187
|
+
temple (0.7.6)
|
188
|
+
terminal-table (1.4.5)
|
182
189
|
thread_safe (0.3.5)
|
183
190
|
tilt (2.0.1)
|
184
191
|
timecop (0.8.0)
|
185
|
-
timers (4.0.
|
192
|
+
timers (4.0.4)
|
186
193
|
hitimes
|
187
194
|
tzinfo (1.2.2)
|
188
195
|
thread_safe (~> 0.1)
|
@@ -207,3 +214,6 @@ PLATFORMS
|
|
207
214
|
DEPENDENCIES
|
208
215
|
polishgeeks-dev-tools
|
209
216
|
sidekiq-glass!
|
217
|
+
|
218
|
+
BUNDLED WITH
|
219
|
+
1.10.6
|
data/MIT-LICENCE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
2
|
+
a copy of this software and associated documentation files (the
|
3
|
+
"Software"), to deal in the Software without restriction, including
|
4
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
5
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
6
|
+
permit persons to whom the Software is furnished to do so, subject to
|
7
|
+
the following conditions:
|
8
|
+
|
9
|
+
The above copyright notice and this permission notice shall be
|
10
|
+
included in all copies or substantial portions of the Software.
|
11
|
+
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
13
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
14
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
15
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
16
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
17
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
18
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[![Build Status](https://travis-ci.org/karafka/sidekiq-glass.svg?branch=master)](https://travis-ci.org/karafka/sidekiq-glass) [![Code Climate](https://codeclimate.com/github/karafka/sidekiq-glass/badges/gpa.svg)](https://codeclimate.com/github/karafka/sidekiq-glass)
|
4
4
|
|
5
5
|
Sidekiq worker wrapper that provides optional timeout and after failure (reentrancy).
|
6
|
-
|
6
|
+
|
7
7
|
## Reentrancy
|
8
8
|
|
9
9
|
If you don't know what is reentrancy, you can read about it [here](http://dev.mensfeld.pl/2014/05/ruby-rails-sinatra-background-processing-reentrancy-for-your-workers-is-a-must-be/).
|
@@ -16,6 +16,7 @@ For this, the following methods can be defined:
|
|
16
16
|
| Method | Arguments | Description |
|
17
17
|
|------------------|-----------|---------------------------------------------------------------------------------------------------------------|
|
18
18
|
| self.timeout= | Integer | Set the number of seconds that a job can take to finish (if not defined, Sidekiq timeout will be applied) |
|
19
|
+
| self.logger= | Logger | Set logger which will be used by Sidekiq Glass (if not defined, null logger will be used) |
|
19
20
|
| execute | any_args | Required method that will be invoked when calling Worker::perform_async |
|
20
21
|
| after_failure | any_args | Optional method that will be invoked if the execute method fails |
|
21
22
|
|
@@ -48,3 +49,27 @@ end
|
|
48
49
|
|
49
50
|
Worker2.perform_async(example1, example2, example3)
|
50
51
|
```
|
52
|
+
|
53
|
+
## References
|
54
|
+
|
55
|
+
* [Sidekiq](http://sidekiq.org/)
|
56
|
+
* [Karafka framework](https://github.com/karafka/karafka)
|
57
|
+
* [Waterdrop](https://github.com/karafka/waterdrop)
|
58
|
+
* [Sidekiq Glass](https://github.com/karafka/sidekiq-glass)
|
59
|
+
* [Envlogic](https://github.com/karafka/envlogic)
|
60
|
+
* [Null Logger](https://github.com/karafka/null-logger)
|
61
|
+
|
62
|
+
## Note on Patches/Pull Requests
|
63
|
+
|
64
|
+
Fork the project.
|
65
|
+
Make your feature addition or bug fix.
|
66
|
+
Add tests for it. This is important so I don't break it in a future version unintentionally.
|
67
|
+
Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull). Send me a pull request. Bonus points for topic branches.
|
68
|
+
|
69
|
+
Each pull request must pass our quality requirements. To check if everything is as it should be, we use [PolishGeeks Dev Tools](https://github.com/polishgeeks/polishgeeks-dev-tools) that combine multiple linters and code analyzers. Please run:
|
70
|
+
|
71
|
+
```bash
|
72
|
+
bundle exec rake
|
73
|
+
```
|
74
|
+
|
75
|
+
to check if everything is in order. After that you can submit a pull request.
|
data/lib/sidekiq_glass.rb
CHANGED
data/lib/sidekiq_glass/worker.rb
CHANGED
@@ -26,6 +26,12 @@ module SidekiqGlass
|
|
26
26
|
|
27
27
|
class << self
|
28
28
|
attr_accessor :timeout
|
29
|
+
attr_writer :logger
|
30
|
+
|
31
|
+
# @return [Logger] logger that we want to use
|
32
|
+
def logger
|
33
|
+
@logger ||= NullLogger.new
|
34
|
+
end
|
29
35
|
end
|
30
36
|
|
31
37
|
# @param args Any arguments that we can get from Sidekiq
|
@@ -36,6 +42,7 @@ module SidekiqGlass
|
|
36
42
|
execute(*args)
|
37
43
|
end
|
38
44
|
rescue => exception
|
45
|
+
self.class.logger.fatal(exception)
|
39
46
|
after_failure(*args) if respond_to?(:after_failure)
|
40
47
|
raise exception
|
41
48
|
end
|
data/sidekiq-glass.gemspec
CHANGED
@@ -9,13 +9,14 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.platform = Gem::Platform::RUBY
|
10
10
|
spec.authors = ['Maciej Mensfeld', 'Pavlo Vavruk']
|
11
11
|
spec.email = %w( maciej@mensfeld.pl pavlo.vavruk@gmail.com )
|
12
|
-
|
13
|
-
spec.summary = ''
|
12
|
+
spec.summary = 'Sidekiq worker timeout and reentrancy!'
|
14
13
|
spec.description = 'Sidekiq worker wrapper that provides optional timeout and after failure (reentrancy)'
|
15
|
-
spec.homepage = ''
|
14
|
+
spec.homepage = 'https://github.com/karafka/sidekiq-glass'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.add_dependency 'sidekiq', '3.4.1'
|
18
18
|
spec.add_dependency 'celluloid', '0.16.0'
|
19
|
+
spec.add_dependency 'null-logger'
|
19
20
|
|
20
21
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
21
22
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-glass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-09-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sidekiq
|
@@ -39,6 +39,20 @@ dependencies:
|
|
39
39
|
- - '='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 0.16.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: null-logger
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
42
56
|
description: Sidekiq worker wrapper that provides optional timeout and after failure
|
43
57
|
(reentrancy)
|
44
58
|
email:
|
@@ -52,8 +66,10 @@ files:
|
|
52
66
|
- ".ruby-gemset"
|
53
67
|
- ".ruby-version"
|
54
68
|
- ".travis.yml"
|
69
|
+
- CHANGELOG.md
|
55
70
|
- Gemfile
|
56
71
|
- Gemfile.lock
|
72
|
+
- MIT-LICENCE
|
57
73
|
- README.md
|
58
74
|
- Rakefile
|
59
75
|
- lib/sidekiq_glass.rb
|
@@ -61,8 +77,9 @@ files:
|
|
61
77
|
- lib/sidekiq_glass/version.rb
|
62
78
|
- lib/sidekiq_glass/worker.rb
|
63
79
|
- sidekiq-glass.gemspec
|
64
|
-
homepage:
|
65
|
-
licenses:
|
80
|
+
homepage: https://github.com/karafka/sidekiq-glass
|
81
|
+
licenses:
|
82
|
+
- MIT
|
66
83
|
metadata: {}
|
67
84
|
post_install_message:
|
68
85
|
rdoc_options: []
|
@@ -80,9 +97,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
97
|
version: '0'
|
81
98
|
requirements: []
|
82
99
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.4.
|
100
|
+
rubygems_version: 2.4.8
|
84
101
|
signing_key:
|
85
102
|
specification_version: 4
|
86
|
-
summary:
|
103
|
+
summary: Sidekiq worker timeout and reentrancy!
|
87
104
|
test_files: []
|
88
105
|
has_rdoc:
|