workhorse 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b1cc4ec91d5c8cde5e214aff39f298f3fa9591b6693250158250fd8de87dd19
4
- data.tar.gz: e333e77dc8bb0a24b809324a54d014f56b9373ccc0f16dc5f58052fa7bd1bbe3
3
+ metadata.gz: 36904c2ff67ab30f876e47515dfd81ccb97715a6e3d563ba93bd59422374d660
4
+ data.tar.gz: 0c9c66eb75727e78fc842e1a30de12876da67a571aa255855e3ae1e63c27f847
5
5
  SHA512:
6
- metadata.gz: af21dcc9cf0672dc71ae1b5ec2d61e6245cf6a24fc4b599d1c21c36c06e20cbc46b59248ea0b6232589eced87305c408cbe7254e6817fdb5bb2ec294181e87a7
7
- data.tar.gz: 368889c80a413ad8e0343a5227ba70081470931e427ca7ec7c1b1bad6cee59af2a2f9bffe31fb879f1d1a81f2233f506cb038d896dce08b2551733873c013f1f
6
+ metadata.gz: 0d57c98c31ad7c25f4ad267fe3caa21ae831e986579fef5f2f848c21a7977c0790b461e3372d4cff5e8e89efdb7a0774f06a90542bf0fb4c87baabe8c472ad06
7
+ data.tar.gz: c99c9d68c24dcccf1bdd164c066466a9c68fa94c7f66dbdc14986dc841e99c0361e32d53a0e2a85226de9c3580ea295254e2c4cb49cd53e974fc28150d3c6e0b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Workhorse Changelog
2
2
 
3
+ ## 1.2.7 - 2022-04-07
4
+
5
+ * Adapt exit status of shell handler to return with exit code `2` when a worker
6
+ is in an unexpected status. Previously, this lead to exit code `1` and made it
7
+ hard to distinguish from fatal errors.
8
+
3
9
  ## 1.2.6 - 2022-01-11
4
10
 
5
11
  * Add daemon command `restart-logging`, which sends a `HUP` interrupt to all
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.6
1
+ 1.2.7
@@ -78,8 +78,9 @@ Options:
78
78
  Show this message
79
79
 
80
80
  Exit status:
81
- 0 if OK,
82
- 1 if at least one worker has an unexpected status,
81
+ 0 if OK,
82
+ 1 on fatal errors outside of workhorse,
83
+ 2 if at least one worker has an unexpected status,
83
84
  99 on all other errors.
84
85
  USAGE
85
86
  end
@@ -46,7 +46,7 @@ module Workhorse
46
46
 
47
47
  if pid_file && pid
48
48
  warn "Worker ##{worker.id} (#{worker.name}): Already started (PID #{pid})" unless quiet
49
- code = 1
49
+ code = 2
50
50
  elsif pid_file
51
51
  File.delete pid_file
52
52
  puts "Worker ##{worker.id} (#{worker.name}): Starting (stale pid file)" unless quiet
@@ -74,7 +74,7 @@ module Workhorse
74
74
  puts "Worker (#{worker.name}) ##{worker.id}: Already stopped (stale PID file)"
75
75
  else
76
76
  warn "Worker (#{worker.name}) ##{worker.id}: Already stopped"
77
- code = 1
77
+ code = 2
78
78
  end
79
79
  end
80
80
 
@@ -91,10 +91,10 @@ module Workhorse
91
91
  puts "Worker ##{worker.id} (#{worker.name}): Running" unless quiet
92
92
  elsif pid_file
93
93
  warn "Worker ##{worker.id} (#{worker.name}): Not running (stale PID file)" unless quiet
94
- code = 1
94
+ code = 2
95
95
  else
96
96
  warn "Worker ##{worker.id} (#{worker.name}): Not running" unless quiet
97
- code = 1
97
+ code = 2
98
98
  end
99
99
  end
100
100
 
@@ -124,14 +124,14 @@ module Workhorse
124
124
  code = 0
125
125
 
126
126
  for_each_worker do |worker|
127
- pid_file, pid = read_pid(worker)
127
+ _pid_file, pid = read_pid(worker)
128
128
 
129
129
  begin
130
130
  Process.kill 'HUP', pid
131
131
  puts "Worker (#{worker.name}) ##{worker.id}: Sent signal for restart-logging"
132
132
  rescue Errno::ESRCH
133
133
  warn "Worker (#{worker.name}) ##{worker.id}: Could not send signal for restart-logging, process not found"
134
- code = 1
134
+ code = 2
135
135
  end
136
136
  end
137
137
 
@@ -73,7 +73,7 @@ class ActiveJob::QueueAdapters::WorkhorseAdapterTest < WorkhorseTest
73
73
  work 0.5, polling_interval: 0.1
74
74
  assert_equal 'waiting', Workhorse::DbJob.first.state
75
75
 
76
- work 1.5, polling_interval: 0.1
76
+ work 3, polling_interval: 0.1
77
77
  assert_equal 'succeeded', Workhorse::DbJob.first.reload.state
78
78
  end
79
79
 
@@ -61,16 +61,16 @@ class Workhorse::PoolTest < WorkhorseTest
61
61
 
62
62
  assert_equal 0, on_idle_calls.value
63
63
 
64
- p.post { sleep 0.2 }
65
64
  p.post { sleep 0.4 }
65
+ p.post { sleep 0.8 }
66
66
 
67
67
  sleep 0.1
68
68
  assert_equal 0, on_idle_calls.value
69
69
 
70
- sleep 0.2
70
+ sleep 0.6
71
71
  assert_equal 1, on_idle_calls.value
72
72
 
73
- sleep 0.1
73
+ sleep 0.9
74
74
  assert_equal 2, on_idle_calls.value
75
75
  end
76
76
  end
data/workhorse.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: workhorse 1.2.6 ruby lib
2
+ # stub: workhorse 1.2.7 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "workhorse".freeze
6
- s.version = "1.2.6"
6
+ s.version = "1.2.7"
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 = "2022-01-11"
11
+ s.date = "2022-04-07"
12
12
  s.files = [".github/workflows/ruby.yml".freeze, ".gitignore".freeze, ".releaser_config".freeze, ".rubocop.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.2.6
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sitrox
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-11 00:00:00.000000000 Z
11
+ date: 2022-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -178,8 +178,8 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
- description:
182
- email:
181
+ description:
182
+ email:
183
183
  executables: []
184
184
  extensions: []
185
185
  extra_rdoc_files: []
@@ -227,10 +227,10 @@ files:
227
227
  - test/workhorse/pool_test.rb
228
228
  - test/workhorse/worker_test.rb
229
229
  - workhorse.gemspec
230
- homepage:
230
+ homepage:
231
231
  licenses: []
232
232
  metadata: {}
233
- post_install_message:
233
+ post_install_message:
234
234
  rdoc_options: []
235
235
  require_paths:
236
236
  - lib
@@ -245,8 +245,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
245
  - !ruby/object:Gem::Version
246
246
  version: '0'
247
247
  requirements: []
248
- rubygems_version: 3.2.22
249
- signing_key:
248
+ rubygems_version: 3.0.3.1
249
+ signing_key:
250
250
  specification_version: 4
251
251
  summary: Multi-threaded job backend with database queuing for ruby.
252
252
  test_files: