workhorse 1.2.21 → 1.2.22

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: 8d592413ecdd60fc3b3885fa2b8ed621fbc06a1010f6f52e6f3275164a971a2e
4
- data.tar.gz: 476a0a3db5004cd9624f125d57e36fe71f09de114dbb11f9f61320f192c27291
3
+ metadata.gz: 20eef573615adbfed9958ae1d5f2e005cfca827060f2b632dbd17b624c2273ec
4
+ data.tar.gz: 3be17bded0b07b544b5d1d2978470d7684dc1d2e4ca6588b03745a02af11bfd2
5
5
  SHA512:
6
- metadata.gz: ac0151e9dc1f74b7ec6d45bb52b50d63a43e1f81d45da6015582f2357b5700cf2aa366e18c9a8d819405f2bb32d00dfd1bdb7158a607559a0488b09f6eb44ff0
7
- data.tar.gz: 8744eca3567ce431b193cd7b7e01a49f1004ae370ac55338af984f3c6486f1553cf8aebf47a4b47374836b28da83fac1ac21726434dfba29a4391e71a0ce932f
6
+ metadata.gz: 1a2c29dc077d8557b4d2ff2bdad9f980d0e24f6794f5a42d26ae731f0c8a7ba24e78d980b39ba087d985529ce701860ef9a876eba70b38c10d007f6516ed6a9b
7
+ data.tar.gz: 88c45f4571b11a51021accaf4145d65fe48fbad6add8170ce830ad31c7e2ddc6b7422e41f1ca1b3f6e0a2bf06351d80f77323889945f25aac16c5068ed51dff7
@@ -40,7 +40,7 @@ jobs:
40
40
  uses: nick-fields/retry@v2
41
41
  with:
42
42
  timeout_seconds: 120
43
- retry_on: error
43
+ retry_on: any
44
44
  max_attempts: 3
45
45
  command: bundle exec rake test TESTOPTS='--verbose'
46
46
 
@@ -54,4 +54,4 @@ jobs:
54
54
  ruby-version: 2.5.1
55
55
  bundler-cache: true
56
56
  - name: Run rubocop
57
- run: bundle exec rubocop
57
+ run: bundle exec rubocop
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Workhorse Changelog
2
2
 
3
+ ## 1.2.22 - 2024-08-20
4
+
5
+ * Change `retry-on` in actions to `any`: also retry when the action hits a timeout
6
+
7
+ * Comply with RuboCop
8
+
9
+ * Skip `at_exit` handlers when exiting in ShellHandler
10
+
11
+ Sitrox reference: #128333.
12
+
3
13
  ## 1.2.21 - 2024-07-02
4
14
 
5
15
  * Add active record release to `create_table_jobs` migration
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.21
1
+ 1.2.22
@@ -19,22 +19,22 @@ module Workhorse
19
19
  begin
20
20
  case ARGV.first
21
21
  when 'start'
22
- exit daemon.start
22
+ exit! daemon.start
23
23
  when 'stop'
24
- exit daemon.stop
24
+ exit! daemon.stop
25
25
  when 'kill'
26
- exit daemon.stop(true)
26
+ exit! daemon.stop(true)
27
27
  when 'status'
28
- exit daemon.status
28
+ exit! daemon.status
29
29
  when 'watch'
30
- exit daemon.watch
30
+ exit! daemon.watch
31
31
  when 'restart'
32
- exit daemon.restart
32
+ exit! daemon.restart
33
33
  when 'restart-logging'
34
- exit daemon.restart_logging
34
+ exit! daemon.restart_logging
35
35
  when 'usage'
36
36
  usage
37
- exit 99
37
+ exit! 99
38
38
  else
39
39
  usage
40
40
  end
@@ -9,7 +9,7 @@ module Workhorse
9
9
  end
10
10
 
11
11
  def perform
12
- begin
12
+ begin # rubocop:disable Style/RedundantBegin
13
13
  fail 'Performer can only run once.' if @started
14
14
  @started = true
15
15
  perform!
@@ -21,7 +21,7 @@ module Workhorse
21
21
  private
22
22
 
23
23
  def perform!
24
- begin
24
+ begin # rubocop:disable Style/RedundantBegin
25
25
  Thread.current[:workhorse_current_performer] = self
26
26
 
27
27
  ActiveRecord::Base.connection_pool.with_connection do
@@ -92,7 +92,7 @@ module Workhorse
92
92
 
93
93
  # Get pids without active process
94
94
  orphaned_pids = job_pids.select do |pid|
95
- begin
95
+ begin # rubocop:disable Style/RedundantBegin
96
96
  Process.getpgid(pid)
97
97
  false
98
98
  rescue Errno::ESRCH
@@ -141,7 +141,7 @@ module Workhorse
141
141
  end
142
142
 
143
143
  def with_global_lock(name: :workhorse, timeout: 2, &_block)
144
- begin
144
+ begin # rubocop:disable Style/RedundantBegin
145
145
  if @is_oracle
146
146
  result = Workhorse::DbJob.connection.select_all(
147
147
  "SELECT DBMS_LOCK.REQUEST(#{ORACLE_LOCK_HANDLE}, #{ORACLE_LOCK_MODE}, #{timeout}) FROM DUAL"
@@ -169,17 +169,17 @@ module Workhorse
169
169
  @max_global_lock_fails_reached = true
170
170
 
171
171
  worker.log 'Could not obtain global lock, retrying with next poll. ' \
172
- 'This will be the last such message for this worker until ' \
173
- 'the issue is resolved.', :warn
172
+ 'This will be the last such message for this worker until ' \
173
+ 'the issue is resolved.', :warn
174
174
 
175
175
  message = "Worker reached maximum number of consecutive times (#{Workhorse.max_global_lock_fails}) " \
176
- "where the global lock could no be acquired within the specified timeout (#{timeout}). " \
177
- 'A worker that obtained this lock may have crashed without ending the database ' \
178
- 'connection properly. On MySQL, use "show processlist;" to see which connection(s) ' \
179
- 'is / are holding the lock for a long period of time and consider killing them using ' \
180
- "MySQL's \"kill <Id>\" command. This message will be issued only once per worker " \
181
- 'and may only be re-triggered if the error happens again *after* the lock has ' \
182
- 'been solved in the meantime.'
176
+ "where the global lock could no be acquired within the specified timeout (#{timeout}). " \
177
+ 'A worker that obtained this lock may have crashed without ending the database ' \
178
+ 'connection properly. On MySQL, use "show processlist;" to see which connection(s) ' \
179
+ 'is / are holding the lock for a long period of time and consider killing them using ' \
180
+ "MySQL's \"kill <Id>\" command. This message will be issued only once per worker " \
181
+ 'and may only be re-triggered if the error happens again *after* the lock has ' \
182
+ 'been solved in the meantime.'
183
183
 
184
184
  worker.log message
185
185
  exception = StandardError.new(message)
@@ -34,7 +34,7 @@ module Workhorse
34
34
  active_threads.increment
35
35
 
36
36
  @executor.post do
37
- begin
37
+ begin # rubocop:disable Style/RedundantBegin
38
38
  yield
39
39
  ensure
40
40
  active_threads.decrement
@@ -142,13 +142,13 @@ module Workhorse
142
142
  end
143
143
 
144
144
  def perform(db_job_id)
145
- begin
145
+ begin # rubocop:disable Style/RedundantBegin
146
146
  mutex.synchronize do
147
147
  assert_state! :running
148
148
  log "Posting job #{db_job_id} to thread pool"
149
149
 
150
150
  @pool.post do
151
- begin
151
+ begin # rubocop:disable Style/RedundantBegin
152
152
  Workhorse::Performer.new(db_job_id, self).perform
153
153
  rescue Exception => e
154
154
  log %(#{e.message}\n#{e.backtrace.join("\n")}), :error
data/workhorse.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: workhorse 1.2.21 ruby lib
2
+ # stub: workhorse 1.2.22 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "workhorse".freeze
6
- s.version = "1.2.21"
6
+ s.version = "1.2.22"
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 = "2024-07-02"
11
+ s.date = "2024-08-20"
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/active_job_extension.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/daemon_test.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.4.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: 1.2.21
4
+ version: 1.2.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sitrox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-02 00:00:00.000000000 Z
11
+ date: 2024-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
247
  - !ruby/object:Gem::Version
248
248
  version: '0'
249
249
  requirements: []
250
- rubygems_version: 3.4.6
250
+ rubygems_version: 3.5.4
251
251
  signing_key:
252
252
  specification_version: 4
253
253
  summary: Multi-threaded job backend with database queuing for ruby.