workhorse 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/lib/workhorse/pool.rb +10 -1
- data/test/workhorse/pool_test.rb +34 -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: 3e0ec8f7b72f3bdfbe540ba647baf9ed2c746119e6592be2b95e8e3e1397e53c
|
4
|
+
data.tar.gz: 542e7ca25aca517b4539162cde18c211165b29ba8653b62653d6e0b6ecd1a715
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c13715991ee9eb3195afd4cef7fc3c7789025bf445bb56750f90f3c2f885401ee40efd7125335e836453dcda63cb46a4a8c5488f6b24f96e3b5e57856b3f6071
|
7
|
+
data.tar.gz: 2d3f9d52eac7f1bbc9fd98ae2ba3ca57c8088b00ee5a0abe8865aeb2522dff0184f03360c9a17f375fee39a8d620d6ea2c95c861af35d686044a1f8e25dff01a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Workhorse Changelog
|
2
2
|
|
3
|
+
## 0.6.4 - 2019-10-12
|
4
|
+
|
5
|
+
* Fix #22 where an exception with message `No live threads left. Deadlock?`
|
6
|
+
could be thrown in the worker processes.
|
7
|
+
|
3
8
|
## 0.6.3 - 2019-09-02
|
4
9
|
|
5
10
|
* Fix examples in changelog, readme and generator for starting workers. Some of
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.4
|
data/lib/workhorse/pool.rb
CHANGED
@@ -48,8 +48,17 @@ module Workhorse
|
|
48
48
|
@size - @active_threads.value
|
49
49
|
end
|
50
50
|
|
51
|
+
# Waits until the pool is shut down. This will wait forever unless you
|
52
|
+
# eventually call shutdown (either before calling `wait` or after it in
|
53
|
+
# another thread).
|
51
54
|
def wait
|
52
|
-
|
55
|
+
# Here we use a loop-sleep combination instead of using
|
56
|
+
# ThreadPoolExecutor's `wait_for_termination`. See issue #21 for more
|
57
|
+
# information.
|
58
|
+
loop do
|
59
|
+
break if @executor.shutdown?
|
60
|
+
sleep 0.1
|
61
|
+
end
|
53
62
|
end
|
54
63
|
|
55
64
|
# Shuts down the pool and waits for termination.
|
data/test/workhorse/pool_test.rb
CHANGED
@@ -19,6 +19,40 @@ class Workhorse::PoolTest < WorkhorseTest
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
# This tries to reproduce issue #21 where the exception "No live threads left.
|
23
|
+
# Deadlock?" was raised when trying to call `wait` on a pool on which
|
24
|
+
# `shutdown` has not been called yet.
|
25
|
+
def test_issue_22
|
26
|
+
# ---------------------------------------------------------------
|
27
|
+
# Here we forcefully disconnect AR and force all other threads
|
28
|
+
# beside the current to exit, as issue #22 cannot be reproduced
|
29
|
+
# when there are other threads besides the current one around.
|
30
|
+
# ---------------------------------------------------------------
|
31
|
+
ActiveRecord::Base.connection_pool.disconnect
|
32
|
+
|
33
|
+
Thread.list.each do |thread|
|
34
|
+
thread.exit unless thread == Thread.current
|
35
|
+
end
|
36
|
+
|
37
|
+
# ---------------------------------------------------------------
|
38
|
+
# The following resulted in an exception and should now work
|
39
|
+
# without any exception.
|
40
|
+
# ---------------------------------------------------------------
|
41
|
+
assert_nothing_raised do
|
42
|
+
p = Workhorse::Pool.new(1)
|
43
|
+
p.post do
|
44
|
+
sleep 1
|
45
|
+
end
|
46
|
+
|
47
|
+
Thread.new do
|
48
|
+
sleep 2
|
49
|
+
p.shutdown
|
50
|
+
end
|
51
|
+
|
52
|
+
p.wait
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
22
56
|
def test_on_idle
|
23
57
|
on_idle_calls = Concurrent::AtomicFixnum.new
|
24
58
|
|
data/workhorse.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: workhorse 0.6.
|
2
|
+
# stub: workhorse 0.6.4 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "workhorse".freeze
|
6
|
-
s.version = "0.6.
|
6
|
+
s.version = "0.6.4"
|
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 = "2019-09-
|
11
|
+
s.date = "2019-09-12"
|
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/active_job/queue_adapters/workhorse_adapter.rb".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_active_job.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/scoped_env.rb".freeze, "lib/workhorse/worker.rb".freeze, "test/active_job/queue_adapters/workhorse_adapter_test.rb".freeze, "test/lib/db_schema.rb".freeze, "test/lib/jobs.rb".freeze, "test/lib/test_helper.rb".freeze, "test/workhorse/db_job_test.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 = "3.0.3".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.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sitrox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|