workhorse 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +5 -1
- data/VERSION +1 -1
- data/lib/workhorse.rb +3 -2
- data/lib/workhorse/daemon.rb +3 -1
- data/lib/workhorse/jobs/detect_stale_jobs_job.rb +2 -2
- data/lib/workhorse/poller.rb +3 -3
- data/test/workhorse/poller_test.rb +3 -1
- data/workhorse.gemspec +3 -3
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b381576f799a0b69cf90e0df551cae0f967b1462bb744383933ca3e82be785d
|
4
|
+
data.tar.gz: c298d93548baee24c30a739b8ff3ea60ce61e91fcaf4c40cead630b29bb024d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc45be8c2c2ee319867798427b6994d5eba4ad6623419f54c13ed500f2a722b90acc8c5dffbd5d0e92ec6a82b4de9484559eed6798e845159210eaaf00fb324a
|
7
|
+
data.tar.gz: 8d7926b6c830b94aad5e1e77f4951ebd68c6d0cfd4baccd4d004d63fa9aa4701673114b97371f72f05806a2616bc5fcf633e747441e860aff13fd4b90bf4d158
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# Workhorse Changelog
|
2
2
|
|
3
|
+
## 1.0.1 - 2020-12-15
|
4
|
+
|
5
|
+
* Fix handling of empty pid files
|
6
|
+
|
3
7
|
## 1.0.0 - 2020-09-21
|
4
8
|
|
5
|
-
* Stable release,
|
9
|
+
* Stable release, identical to 1.0.0.beta2 but now extensively battle-tested
|
6
10
|
|
7
11
|
## 1.0.0.beta2 - 2020-08-27
|
8
12
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/lib/workhorse.rb
CHANGED
data/lib/workhorse/daemon.rb
CHANGED
@@ -177,7 +177,9 @@ module Workhorse
|
|
177
177
|
file = pid_file_for(worker)
|
178
178
|
|
179
179
|
if File.exist?(file)
|
180
|
-
|
180
|
+
raw_pid = IO.read(file)
|
181
|
+
return nil, nil if raw_pid.blank?
|
182
|
+
pid = Integer(raw_pid)
|
181
183
|
return file, process?(pid) ? pid : nil
|
182
184
|
else
|
183
185
|
return nil, nil
|
@@ -22,7 +22,7 @@ module Workhorse::Jobs
|
|
22
22
|
rel = rel.where('locked_at < ?', @locked_to_started_threshold.seconds.ago)
|
23
23
|
ids = rel.pluck(:id)
|
24
24
|
|
25
|
-
|
25
|
+
unless ids.empty?
|
26
26
|
messages << "Detected #{ids.size} jobs that were locked more than "\
|
27
27
|
"#{@locked_to_started_threshold}s ago and might be stale: #{ids.inspect}."
|
28
28
|
end
|
@@ -34,7 +34,7 @@ module Workhorse::Jobs
|
|
34
34
|
rel = rel.where('started_at < ?', @run_time_threshold.seconds.ago)
|
35
35
|
ids = rel.pluck(:id)
|
36
36
|
|
37
|
-
|
37
|
+
unless ids.empty?
|
38
38
|
messages << "Detected #{ids.size} jobs that are running for longer than "\
|
39
39
|
"#{@run_time_threshold}s ago and might be stale: #{ids.inspect}."
|
40
40
|
end
|
data/lib/workhorse/poller.rb
CHANGED
@@ -3,8 +3,8 @@ module Workhorse
|
|
3
3
|
MIN_LOCK_TIMEOUT = 0.1 # In seconds
|
4
4
|
MAX_LOCK_TIMEOUT = 1.0 # In seconds
|
5
5
|
|
6
|
-
ORACLE_LOCK_MODE
|
7
|
-
ORACLE_LOCK_HANDLE =
|
6
|
+
ORACLE_LOCK_MODE = 6 # X_MODE (exclusive)
|
7
|
+
ORACLE_LOCK_HANDLE = 478_564_848 # Randomly chosen number
|
8
8
|
|
9
9
|
attr_reader :worker
|
10
10
|
attr_reader :table
|
@@ -72,7 +72,7 @@ module Workhorse
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
def with_global_lock(name: :workhorse, timeout: 2, &
|
75
|
+
def with_global_lock(name: :workhorse, timeout: 2, &_block)
|
76
76
|
if @is_oracle
|
77
77
|
result = Workhorse::DbJob.connection.select_all(
|
78
78
|
"SELECT DBMS_LOCK.REQUEST(#{ORACLE_LOCK_HANDLE}, #{ORACLE_LOCK_MODE}, #{timeout}) FROM DUAL"
|
@@ -48,7 +48,7 @@ class Workhorse::PollerTest < WorkhorseTest
|
|
48
48
|
assert_equal %w[q1 q2], w.poller.send(:valid_queues)
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
51
|
+
def test_valid_queues_2
|
52
52
|
w = Workhorse::Worker.new(polling_interval: 60)
|
53
53
|
|
54
54
|
assert_equal [], w.poller.send(:valid_queues)
|
@@ -148,6 +148,7 @@ class Workhorse::PollerTest < WorkhorseTest
|
|
148
148
|
assert_equal 25, used_workers
|
149
149
|
end
|
150
150
|
|
151
|
+
# rubocop: disable Style/GlobalVars
|
151
152
|
def test_connection_loss
|
152
153
|
$thread_conn = nil
|
153
154
|
|
@@ -174,6 +175,7 @@ class Workhorse::PollerTest < WorkhorseTest
|
|
174
175
|
|
175
176
|
assert_equal 1, Workhorse::DbJob.succeeded.count
|
176
177
|
end
|
178
|
+
# rubocop: enable Style/GlobalVars
|
177
179
|
|
178
180
|
private
|
179
181
|
|
data/workhorse.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: workhorse 1.0.
|
2
|
+
# stub: workhorse 1.0.1 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "workhorse".freeze
|
6
|
-
s.version = "1.0.
|
6
|
+
s.version = "1.0.1"
|
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 = "2020-
|
11
|
+
s.date = "2020-12-15"
|
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/detect_stale_jobs_job.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: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sitrox
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -192,8 +192,8 @@ dependencies:
|
|
192
192
|
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
|
-
description:
|
196
|
-
email:
|
195
|
+
description:
|
196
|
+
email:
|
197
197
|
executables: []
|
198
198
|
extensions: []
|
199
199
|
extra_rdoc_files: []
|
@@ -241,10 +241,10 @@ files:
|
|
241
241
|
- test/workhorse/pool_test.rb
|
242
242
|
- test/workhorse/worker_test.rb
|
243
243
|
- workhorse.gemspec
|
244
|
-
homepage:
|
244
|
+
homepage:
|
245
245
|
licenses: []
|
246
246
|
metadata: {}
|
247
|
-
post_install_message:
|
247
|
+
post_install_message:
|
248
248
|
rdoc_options: []
|
249
249
|
require_paths:
|
250
250
|
- lib
|
@@ -259,8 +259,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
259
|
- !ruby/object:Gem::Version
|
260
260
|
version: '0'
|
261
261
|
requirements: []
|
262
|
-
rubygems_version: 3.1.
|
263
|
-
signing_key:
|
262
|
+
rubygems_version: 3.1.4
|
263
|
+
signing_key:
|
264
264
|
specification_version: 4
|
265
265
|
summary: Multi-threaded job backend with database queuing for ruby.
|
266
266
|
test_files:
|