workhorse 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +7 -1
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/workhorse/performer.rb +2 -2
- data/lib/workhorse/poller.rb +1 -1
- data/lib/workhorse/worker.rb +2 -2
- data/test/lib/jobs.rb +6 -0
- data/test/workhorse/performer_test.rb +18 -0
- data/workhorse.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a4f3666d9865ea9578e5bb735c0889a3701be869f07fc52c971777e41dbae4e
|
4
|
+
data.tar.gz: 3fca0dcf3192f1bc954c8963eb272e4aadcba4a6d2616c57600fd5ae2003a3a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8437d30f0f38fee5cf2c709642af4a4a85439138ba4fbf07935a18577fdde01c1bcccdd14e84579cefee141393b878669702a835852f5ffddd9e2b39ad73699
|
7
|
+
data.tar.gz: d73c6f4432a64d9e26b1b010dc88ac5c9751cb7a7a99bce2b885e17f0b0967c540704a1d6af4a9cb4bd7e2b59dc89648a98c3de305090fa7d91ed11259c2c5aa
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# Workhorse Change log
|
2
2
|
|
3
|
-
## 0.3.
|
3
|
+
## 0.3.6 - 2018-11-14
|
4
|
+
|
5
|
+
* Makes sure all exceptions are caught and handled properly, not only exceptions
|
6
|
+
deriving from `StandardError`. In previous releases, this prevented some
|
7
|
+
exceptions like syntax errors to be handled properly.
|
8
|
+
|
9
|
+
## 0.3.5 - 2018-10-22
|
4
10
|
|
5
11
|
* Adds global callback `on_exception` that allows custom exception handling /
|
6
12
|
exception notification.
|
data/README.md
CHANGED
@@ -252,7 +252,7 @@ callback of your linking, e.g.:
|
|
252
252
|
Workhorse.setup do |config|
|
253
253
|
config.on_exception = proc do |e|
|
254
254
|
# Use gem 'exception_notification' for notifying about exceptions
|
255
|
-
ExceptionNotifier.notify_exception(
|
255
|
+
ExceptionNotifier.notify_exception(e)
|
256
256
|
end
|
257
257
|
end
|
258
258
|
```
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.6
|
data/lib/workhorse/performer.rb
CHANGED
@@ -12,7 +12,7 @@ module Workhorse
|
|
12
12
|
fail 'Performer can only run once.' if @started
|
13
13
|
@started = true
|
14
14
|
perform!
|
15
|
-
rescue => e
|
15
|
+
rescue Exception => e
|
16
16
|
Workhorse.on_exception.call(e)
|
17
17
|
end
|
18
18
|
|
@@ -30,7 +30,7 @@ module Workhorse
|
|
30
30
|
perform_wrapped
|
31
31
|
end
|
32
32
|
end
|
33
|
-
rescue => e
|
33
|
+
rescue Exception => e
|
34
34
|
# ---------------------------------------------------------------
|
35
35
|
# Mark job as failed
|
36
36
|
# ---------------------------------------------------------------
|
data/lib/workhorse/poller.rb
CHANGED
data/lib/workhorse/worker.rb
CHANGED
@@ -129,12 +129,12 @@ module Workhorse
|
|
129
129
|
@pool.post do
|
130
130
|
begin
|
131
131
|
Workhorse::Performer.new(db_job, self).perform
|
132
|
-
rescue => e
|
132
|
+
rescue Exception => e
|
133
133
|
log %(#{e.message}\n#{e.backtrace.join("\n")}), :error
|
134
134
|
end
|
135
135
|
end
|
136
136
|
end
|
137
|
-
rescue => e
|
137
|
+
rescue Exception => e
|
138
138
|
Workhorse.on_exception.call(e)
|
139
139
|
end
|
140
140
|
|
data/test/lib/jobs.rb
CHANGED
@@ -14,6 +14,24 @@ class Workhorse::WorkerTest < WorkhorseTest
|
|
14
14
|
assert_equal 2, DbConnectionTestJob.db_connections.uniq.count
|
15
15
|
end
|
16
16
|
|
17
|
+
def test_success
|
18
|
+
Workhorse.enqueue BasicJob.new(sleep_time: 0.1)
|
19
|
+
work 0.2, polling_interval: 0.2
|
20
|
+
assert_equal 'succeeded', Workhorse::DbJob.first.state
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_exception
|
24
|
+
Workhorse.enqueue FailingTestJob
|
25
|
+
work 0.2, polling_interval: 0.2
|
26
|
+
assert_equal 'failed', Workhorse::DbJob.first.state
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_syntax_exception
|
30
|
+
Workhorse.enqueue SyntaxErrorJob
|
31
|
+
work 0.2, polling_interval: 0.2
|
32
|
+
assert_equal 'failed', Workhorse::DbJob.first.state
|
33
|
+
end
|
34
|
+
|
17
35
|
def test_on_exception
|
18
36
|
old_callback = Workhorse.on_exception
|
19
37
|
exception = nil
|
data/workhorse.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: workhorse 0.3.
|
2
|
+
# stub: workhorse 0.3.6 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "workhorse".freeze
|
6
|
-
s.version = "0.3.
|
6
|
+
s.version = "0.3.6"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Sitrox".freeze]
|
11
|
-
s.date = "2018-
|
11
|
+
s.date = "2018-11-14"
|
12
12
|
s.files = [".gitignore".freeze, ".releaser_config".freeze, ".rubocop.yml".freeze, ".travis.yml".freeze, "CHANGELOG.md".freeze, "FAQ.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "RUBY_VERSION".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/rubocop".freeze, "lib/generators/workhorse/install_generator.rb".freeze, "lib/generators/workhorse/templates/bin/workhorse.rb".freeze, "lib/generators/workhorse/templates/config/initializers/workhorse.rb".freeze, "lib/generators/workhorse/templates/create_table_jobs.rb".freeze, "lib/workhorse.rb".freeze, "lib/workhorse/daemon.rb".freeze, "lib/workhorse/daemon/shell_handler.rb".freeze, "lib/workhorse/db_job.rb".freeze, "lib/workhorse/enqueuer.rb".freeze, "lib/workhorse/jobs/cleanup_succeeded_jobs.rb".freeze, "lib/workhorse/jobs/run_rails_op.rb".freeze, "lib/workhorse/performer.rb".freeze, "lib/workhorse/poller.rb".freeze, "lib/workhorse/pool.rb".freeze, "lib/workhorse/worker.rb".freeze, "test/lib/db_schema.rb".freeze, "test/lib/jobs.rb".freeze, "test/lib/test_helper.rb".freeze, "test/workhorse/enqueuer_test.rb".freeze, "test/workhorse/performer_test.rb".freeze, "test/workhorse/poller_test.rb".freeze, "test/workhorse/pool_test.rb".freeze, "test/workhorse/worker_test.rb".freeze, "workhorse.gemspec".freeze]
|
13
13
|
s.rubygems_version = "2.7.6".freeze
|
14
14
|
s.summary = "Multi-threaded job backend with database queuing for ruby.".freeze
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workhorse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sitrox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|