inst-jobs 3.1.17 → 3.1.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b4b6a00b5e6b9ec0916e799819a8ae75aac19faa368e869772b336f860a8109
4
- data.tar.gz: 8f6a562afbf654e5937a5dc4d2540304ead783bab594722ca5c3b5782f6fdeb6
3
+ metadata.gz: 579d976e72cdd916a94cba74f5761dfe2e483ce05afdb9c75c0a99ce5dcdd08b
4
+ data.tar.gz: f9c2133c273cd8304ce8b67871a1022f535b2e7a1b17500c179e01a7744678f5
5
5
  SHA512:
6
- metadata.gz: 4bbd25cfe653768aa2a755eab2c3ea45530debba4d86e12b8d5a1cfd169ddf3d59fc0fef9773a0e81b2abaeaf886e0dd7be2a208c22fc0e0323fec77205e64e7
7
- data.tar.gz: 9a61ada6fb4f816c0dadaf159f0852d4a31d933dff50ad7dfb5e8439e0dfc09ce9c3c1baf2dc24ab79f41fa79b6ea0b4f703d4903248d436b576924c629511a6
6
+ metadata.gz: 3dc86e0734c2e0ca061e9a10e363cf32edf52207b5a558b6f61d058d1d12af663e094358c5f48a6b4fe08346757676e3d59add62843aa2eb8bacb9652d8def31
7
+ data.tar.gz: f3ea2943a9f283fd8f12870f5626e875b07986e782fe15d385caa5d73502852b6051b9e578b78b86d9f872416a9b3deedb2f1ad310f46ebdff7ec4545fa2a280
@@ -28,21 +28,20 @@ module Delayed
28
28
  attr_accessor :enqueue_result
29
29
 
30
30
  scope :next_in_strand_order, -> { order(:strand_order_override, :id) }
31
+ scope :locked, -> { where.not(locked_by: nil) }
32
+ scope :not_locked, -> { where(locked_by: nil) }
33
+ scope :prefetched, -> { where(arel_table[:locked_by].matches("prefetch%")) }
31
34
 
32
35
  def self.reconnect!
33
- if Rails.version < "6.1"
34
- ::ActiveRecord::Base.connection_handler.clear_all_connections!
35
- else
36
- ::ActiveRecord::Base.connection_handler.clear_all_connections!(nil)
37
- end
36
+ ::ActiveRecord::Base.connection_handler.clear_all_connections!(nil)
38
37
  end
39
38
 
40
39
  class << self
41
- def create(attributes, &block)
40
+ def create(attributes, &)
42
41
  on_conflict = attributes.delete(:on_conflict)
43
42
  # modified from ActiveRecord::Persistence.create and ActiveRecord::Persistence#_insert_record
44
- job = new(attributes, &block)
45
- job.single_step_create(on_conflict: on_conflict)
43
+ job = new(attributes, &)
44
+ job.single_step_create(on_conflict:)
46
45
  end
47
46
 
48
47
  def attempt_advisory_lock(lock_name)
@@ -70,21 +69,12 @@ module Delayed
70
69
  _write_attribute(column, current_time) unless attribute_present?(column)
71
70
  end
72
71
 
73
- attribute_names = if Rails.version < "7.0"
74
- attribute_names_for_partial_writes
75
- else
76
- attribute_names_for_partial_inserts
77
- end
72
+ attribute_names = attribute_names_for_partial_inserts
78
73
  attribute_names = attributes_for_create(attribute_names)
79
74
  values = attributes_with_values(attribute_names)
80
75
 
81
- im = if Rails.version < "7.0"
82
- self.class.arel_table.compile_insert(self.class.send(:_substitute_values, values))
83
- else
84
- im = Arel::InsertManager.new(self.class.arel_table)
85
- im.insert(values.transform_keys { |name| self.class.arel_table[name] })
86
- im
87
- end
76
+ im = Arel::InsertManager.new(self.class.arel_table)
77
+ im.insert(values.transform_keys { |name| self.class.arel_table[name] })
88
78
 
89
79
  lock_and_insert = values["strand"] && instance_of?(Job)
90
80
  # can't use prepared statements if we're combining multiple statemenets
@@ -120,7 +110,7 @@ module Delayed
120
110
  # but we don't need to lock when inserting into Delayed::Failed
121
111
  if values["strand"] && instance_of?(Job)
122
112
  fn_name = connection.quote_table_name("half_md5_as_bigint")
123
- quoted_strand = connection.quote((Rails.version < "7.0") ? values["strand"] : values["strand"].value)
113
+ quoted_strand = connection.quote(values["strand"].value)
124
114
  sql = "SELECT pg_advisory_xact_lock(#{fn_name}(#{quoted_strand})); #{sql}"
125
115
  end
126
116
  result = connection.execute(sql, "#{self.class} Create")
@@ -225,7 +215,7 @@ module Delayed
225
215
  end
226
216
 
227
217
  def self.strand_size(strand)
228
- where(strand: strand).count
218
+ where(strand:).count
229
219
  end
230
220
 
231
221
  def self.running_jobs
@@ -250,7 +240,7 @@ module Delayed
250
240
 
251
241
  if %w[current future].include?(flavor.to_s)
252
242
  queue = query.presence || Delayed::Settings.queue
253
- scope = scope.where(queue: queue)
243
+ scope = scope.where(queue:)
254
244
  end
255
245
 
256
246
  scope
@@ -346,16 +336,16 @@ module Delayed
346
336
  job_count = 0
347
337
  new_strand = "tmp_strand_#{SecureRandom.alphanumeric(16)}"
348
338
  ::Delayed::Job.transaction do
349
- job_count = job_scope.update_all(strand: new_strand, max_concurrent: max_concurrent, next_in_strand: false)
339
+ job_count = job_scope.update_all(strand: new_strand, max_concurrent:, next_in_strand: false)
350
340
  ::Delayed::Job.where(strand: new_strand).order(:id).limit(max_concurrent).update_all(next_in_strand: true)
351
341
  end
352
342
 
353
343
  [job_count, new_strand]
354
344
  end
355
345
 
356
- def self.maybe_silence_periodic_log(&block)
346
+ def self.maybe_silence_periodic_log(&)
357
347
  if Settings.silence_periodic_log
358
- ::ActiveRecord::Base.logger.silence(&block)
348
+ ::ActiveRecord::Base.logger.silence(&)
359
349
  else
360
350
  yield
361
351
  end
@@ -368,7 +358,6 @@ module Delayed
368
358
  prefetch: 0,
369
359
  prefetch_owner: nil,
370
360
  forced_latency: nil)
371
-
372
361
  check_queue(queue)
373
362
  check_priorities(min_priority, max_priority)
374
363
 
@@ -386,7 +375,7 @@ module Delayed
386
375
  target_jobs = all_available(queue,
387
376
  min_priority,
388
377
  max_priority,
389
- forced_latency: forced_latency)
378
+ forced_latency:)
390
379
  .limit(effective_worker_names.length + prefetch)
391
380
  .lock(lock)
392
381
  jobs_with_row_number = all.from(target_jobs)
@@ -429,10 +418,10 @@ module Delayed
429
418
  # very conservatively lock the locked job, so that it won't unlock from underneath us and
430
419
  # leave an orphaned strand
431
420
  advisory_lock("singleton:#{singleton}")
432
- locked_jobs = where(singleton: singleton).where.not(locked_by: nil).lock.pluck(:id)
421
+ locked_jobs = where(singleton:).where.not(locked_by: nil).lock.pluck(:id)
433
422
  # if it's already gone, then we're good and should be able to just retry
434
423
  if locked_jobs.length == 1
435
- updated = where(singleton: singleton, next_in_strand: true)
424
+ updated = where(singleton:, next_in_strand: true)
436
425
  .where(locked_by: nil)
437
426
  .update_all(next_in_strand: false)
438
427
  raise if updated.zero?
@@ -499,8 +488,8 @@ module Delayed
499
488
  check_queue(queue)
500
489
  check_priorities(min_priority, max_priority)
501
490
 
502
- ready_to_run(forced_latency: forced_latency)
503
- .where(priority: min_priority..max_priority, queue: queue)
491
+ ready_to_run(forced_latency:)
492
+ .where(priority: min_priority..max_priority, queue:)
504
493
  .by_priority
505
494
  end
506
495
 
@@ -513,7 +502,7 @@ module Delayed
513
502
  on_conflict = options.delete(:on_conflict) || :use_earliest
514
503
 
515
504
  transaction_for_singleton(singleton, on_conflict) do
516
- job = where(strand: strand, locked_at: nil).next_in_strand_order.first
505
+ job = where(strand:, locked_at: nil).next_in_strand_order.first
517
506
  new_job = new(options)
518
507
  if job
519
508
  new_job.initialize_defaults
@@ -647,7 +636,7 @@ module Delayed
647
636
  self.table_name = :failed_jobs
648
637
 
649
638
  def self.cleanup_old_jobs(before_date, batch_size: 10_000)
650
- where("failed_at < ?", before_date).in_batches(of: batch_size).delete_all
639
+ where(failed_at: ...before_date).in_batches(of: batch_size).delete_all
651
640
  end
652
641
 
653
642
  def requeue!
@@ -40,7 +40,6 @@ module Delayed
40
40
  n_strand: nil,
41
41
  max_attempts: Delayed::Settings.max_attempts,
42
42
  **kwargs)
43
-
44
43
  unless object.respond_to?(:perform)
45
44
  raise ArgumentError, "Cannot enqueue items which do not respond to perform"
46
45
  end
@@ -307,19 +306,14 @@ module Delayed
307
306
 
308
307
  # Moved into its own method so that new_relic can trace it.
309
308
  def invoke_job
309
+ ActiveSupport::ExecutionContext[:job] = self
310
310
  Delayed::Worker.lifecycle.run_callbacks(:invoke_job, self) do
311
311
  Delayed::Job.in_delayed_job = true
312
312
  begin
313
313
  payload_object.perform
314
314
  ensure
315
315
  Delayed::Job.in_delayed_job = false
316
- unless Rails.env.test?
317
- if Rails.version < "6.1"
318
- ::ActiveRecord::Base.clear_active_connections!
319
- else
320
- ::ActiveRecord::Base.clear_active_connections!(nil)
321
- end
322
- end
316
+ ::ActiveRecord::Base.connection_handler.clear_active_connections!(nil) unless Rails.env.test?
323
317
  end
324
318
  end
325
319
  end
@@ -374,7 +368,7 @@ module Delayed
374
368
 
375
369
  private
376
370
 
377
- PARSE_OBJECT_FROM_YAML = %r{!ruby/\w+:([^\s]+)}.freeze
371
+ PARSE_OBJECT_FROM_YAML = %r{!ruby/\w+:([^\s]+)}
378
372
  private_constant :PARSE_OBJECT_FROM_YAML
379
373
 
380
374
  def deserialize(source)
data/lib/delayed/batch.rb CHANGED
@@ -25,8 +25,8 @@ module Delayed
25
25
  end
26
26
 
27
27
  class << self
28
- def serial_batch(opts = {}, &block)
29
- prepare_batches(:serial, opts, &block)
28
+ def serial_batch(opts = {}, &)
29
+ prepare_batches(:serial, opts, &)
30
30
  end
31
31
 
32
32
  private
@@ -51,7 +51,7 @@ module Delayed
51
51
  payload_object = args.delete(:payload_object)
52
52
  Delayed::Job.enqueue(payload_object, **args)
53
53
  else
54
- Delayed::Job.enqueue(Delayed::Batch::PerformableBatch.new(mode, batch), **enqueue_args.merge(batch_args))
54
+ Delayed::Job.enqueue(Delayed::Batch::PerformableBatch.new(mode, batch), **enqueue_args, **batch_args)
55
55
  end
56
56
  end
57
57
  end
@@ -43,7 +43,7 @@ module Delayed
43
43
  # it somewhere useful
44
44
  last_ditch_logfile = Settings.last_ditch_logfile || "log/delayed_job.log"
45
45
  last_ditch_logfile = Settings.expand_rails_path(last_ditch_logfile) if last_ditch_logfile[0] != "|"
46
- $stdin.reopen("/dev/null")
46
+ $stdin.reopen(File::NULL)
47
47
  $stdout.reopen(open(last_ditch_logfile, "a")) # rubocop:disable Security/Open
48
48
  $stderr.reopen($stdout)
49
49
  $stdout.sync = $stderr.sync = true
@@ -51,7 +51,7 @@ module Delayed
51
51
 
52
52
  # stop the currently running daemon (not this current process, the one in the pid_file)
53
53
  def stop(kill: false, pid: self.pid)
54
- alive = status(pid: pid, print: false)
54
+ alive = status(pid:, print: false)
55
55
  if alive == :running || (kill && alive == :draining)
56
56
  puts "Stopping pool #{pid}..."
57
57
  signal = kill ? "TERM" : "QUIT"
@@ -68,9 +68,9 @@ module Delayed
68
68
 
69
69
  def wait(kill)
70
70
  if kill
71
- sleep(0.5) while status(pid: pid, print: false)
71
+ sleep(0.5) while status(pid:, print: false)
72
72
  else
73
- sleep(0.5) while status(pid: pid, print: false) == :running
73
+ sleep(0.5) while status(pid:, print: false) == :running
74
74
  end
75
75
  end
76
76
 
@@ -2,5 +2,14 @@
2
2
 
3
3
  module Delayed
4
4
  class Engine < ::Rails::Engine
5
+ initializer "delayed_job.set_reloader_hook" do |app|
6
+ Delayed::Worker.lifecycle.around(:perform) do |worker, job, &block|
7
+ kwargs = (Rails.version < "7.1") ? {} : { source: "application.delayed_job" }
8
+
9
+ app.reloader.wrap(**kwargs) do
10
+ block.call(worker, job)
11
+ end
12
+ end
13
+ end
5
14
  end
6
15
  end
@@ -30,34 +30,34 @@ module Delayed
30
30
  Delayed::Worker.plugins.each(&:reset!)
31
31
  end
32
32
 
33
- def before(event, &block)
34
- add(:before, event, &block)
33
+ def before(event, &)
34
+ add(:before, event, &)
35
35
  end
36
36
 
37
- def after(event, &block)
38
- add(:after, event, &block)
37
+ def after(event, &)
38
+ add(:after, event, &)
39
39
  end
40
40
 
41
- def around(event, &block)
42
- add(:around, event, &block)
41
+ def around(event, &)
42
+ add(:around, event, &)
43
43
  end
44
44
 
45
- def run_callbacks(event, *args, &block)
45
+ def run_callbacks(event, *args, &)
46
46
  missing_callback(event) unless @callbacks.key?(event)
47
47
 
48
48
  unless EVENTS[event].size == args.size
49
49
  raise ArgumentError, "Callback #{event} expects #{EVENTS[event].size} parameter(s): #{EVENTS[event].join(", ")}"
50
50
  end
51
51
 
52
- @callbacks[event].execute(*args, &block)
52
+ @callbacks[event].execute(*args, &)
53
53
  end
54
54
 
55
55
  private
56
56
 
57
- def add(type, event, &block)
57
+ def add(type, event, &)
58
58
  missing_callback(event) unless @callbacks.key?(event)
59
59
 
60
- @callbacks[event].add(type, &block)
60
+ @callbacks[event].add(type, &)
61
61
  end
62
62
 
63
63
  def missing_callback(event)
@@ -74,12 +74,12 @@ module Delayed
74
74
  @around = ->(*args, &block) { block.call(*args) }
75
75
  end
76
76
 
77
- def execute(*args, &block)
77
+ def execute(*args, &)
78
78
  @before.each { |c| c.call(*args) }
79
- result = @around.call(*args, &block)
79
+ result = @around.call(*args, &)
80
80
  @after.each do |c|
81
81
  if c.arity == args.length + 1 # don't fail for methods that don't define `result:`
82
- c.call(*args, result: result)
82
+ c.call(*args, result:)
83
83
  else
84
84
  c.call(*args)
85
85
  end
@@ -24,9 +24,7 @@ module Delayed
24
24
  end
25
25
  end
26
26
 
27
- def logger
28
- Delayed::Logging.logger
29
- end
27
+ delegate :logger, to: :"Delayed::Logging"
30
28
 
31
29
  def say(message, level = :debug)
32
30
  logger.send(level, message)
@@ -56,10 +56,10 @@ module Delayed
56
56
  connection.after_transaction_commit do
57
57
  ::Delayed::Job.enqueue(::Delayed::PerformableMethod.new(@object,
58
58
  method,
59
- args: args,
60
- kwargs: kwargs,
61
- on_failure: on_failure,
62
- on_permanent_failure: on_permanent_failure,
59
+ args:,
60
+ kwargs:,
61
+ on_failure:,
62
+ on_permanent_failure:,
63
63
  sender: @sender),
64
64
  **@enqueue_args)
65
65
  end
@@ -69,10 +69,10 @@ module Delayed
69
69
 
70
70
  result = ::Delayed::Job.enqueue(::Delayed::PerformableMethod.new(@object,
71
71
  method,
72
- args: args,
73
- kwargs: kwargs,
74
- on_failure: on_failure,
75
- on_permanent_failure: on_permanent_failure,
72
+ args:,
73
+ kwargs:,
74
+ on_failure:,
75
+ on_permanent_failure:,
76
76
  sender: @sender),
77
77
  **@enqueue_args)
78
78
  result = nil unless ignore_transaction
@@ -101,7 +101,7 @@ module Delayed
101
101
 
102
102
  sender ||= __calculate_sender_for_delay
103
103
 
104
- DelayProxy.new(self, sender: sender, **enqueue_args)
104
+ DelayProxy.new(self, sender:, **enqueue_args)
105
105
  end
106
106
 
107
107
  def __calculate_sender_for_delay
@@ -15,7 +15,7 @@ module Delayed
15
15
  self.overrides = {}
16
16
 
17
17
  def self.add_overrides(overrides)
18
- overrides.each do |_name, cron_line|
18
+ overrides.each_value do |cron_line|
19
19
  # throws error if the line is malformed
20
20
  Fugit.do_parse_cron(cron_line)
21
21
  end
@@ -45,7 +45,7 @@ module Delayed
45
45
  # make sure all periodic jobs are scheduled for their next run in the job queue
46
46
  # this auditing should run on the strand
47
47
  def self.perform_audit!
48
- scheduled.each { |_name, periodic| periodic.enqueue }
48
+ scheduled.each_value(&:enqueue)
49
49
  end
50
50
 
51
51
  def initialize(name, cron_line, job_args, block)
data/lib/delayed/pool.rb CHANGED
@@ -69,19 +69,11 @@ module Delayed
69
69
  say "Unlocked #{unlocked_jobs} orphaned jobs" if unlocked_jobs.positive?
70
70
  return if Rails.env.test?
71
71
 
72
- if Rails.version < "6.1"
73
- ActiveRecord::Base.connection_handler.clear_all_connections!
74
- else
75
- ActiveRecord::Base.connection_handler.clear_all_connections!(nil)
76
- end
72
+ ActiveRecord::Base.connection_handler.clear_all_connections!(nil)
77
73
  end
78
74
 
79
75
  def spawn_all_workers
80
- if Rails.version < "6.1"
81
- ActiveRecord::Base.connection_handler.clear_all_connections!
82
- else
83
- ActiveRecord::Base.connection_handler.clear_all_connections!(nil)
84
- end
76
+ ActiveRecord::Base.connection_handler.clear_all_connections!(nil)
85
77
 
86
78
  if @config[:work_queue] == "parent_process"
87
79
  @work_queue = WorkQueue::ParentProcess.new
@@ -97,7 +89,7 @@ module Delayed
97
89
  parent_pid = Process.pid
98
90
  pid = fork_with_reconnects do
99
91
  $0 = "delayed_jobs_work_queue#{Settings.pool_procname_suffix}"
100
- @work_queue.server(parent_pid: parent_pid).run
92
+ @work_queue.server(parent_pid:).run
101
93
  end
102
94
  workers[pid] = :work_queue
103
95
  end
@@ -37,13 +37,7 @@ module Delayed
37
37
 
38
38
  # Release any used connections back to the pool
39
39
  after do
40
- if using_active_record?
41
- if Rails.version < "6.1"
42
- ::ActiveRecord::Base.clear_active_connections!
43
- else
44
- ::ActiveRecord::Base.clear_active_connections!(nil)
45
- end
46
- end
40
+ ::ActiveRecord::Base.connection_handler.clear_active_connections!(nil) if using_active_record?
47
41
  end
48
42
 
49
43
  configure :development do
@@ -88,7 +88,7 @@ module Delayed
88
88
 
89
89
  def apply_worker_config!(config)
90
90
  SETTINGS.each do |setting|
91
- send("#{setting}=", config[setting.to_s]) if config.key?(setting.to_s)
91
+ send(:"#{setting}=", config[setting.to_s]) if config.key?(setting.to_s)
92
92
  end
93
93
  if config.key?("parent_process_client_timeout")
94
94
  parent_process.client_timeout = config["parent_process_client_timeout"]
@@ -17,8 +17,8 @@ module Delayed
17
17
  end
18
18
  end
19
19
 
20
- def self.track_created(&block)
21
- job_tracking = JobTracking.track(&block)
20
+ def self.track_created(&)
21
+ job_tracking = JobTracking.track(&)
22
22
  job_tracking.created
23
23
  end
24
24
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Delayed
4
- VERSION = "3.1.17"
4
+ VERSION = "3.1.18.1"
5
5
  end
@@ -75,7 +75,7 @@ module Delayed
75
75
  readable, = IO.select(handles, nil, nil, timeout)
76
76
  readable&.each { |s| handle_read(s) }
77
77
  Delayed::Worker.lifecycle.run_callbacks(:check_for_work, self) do
78
- check_for_work(forced_latency: forced_latency)
78
+ check_for_work(forced_latency:)
79
79
  end
80
80
  unlock_timed_out_prefetched_jobs
81
81
  end
@@ -159,8 +159,8 @@ module Delayed
159
159
  worker_config[:min_priority],
160
160
  worker_config[:max_priority],
161
161
  prefetch: (Settings.fetch_batch_size * (worker_config[:workers] || 1)) - recipients.length,
162
- prefetch_owner: prefetch_owner,
163
- forced_latency: forced_latency
162
+ prefetch_owner:,
163
+ forced_latency:
164
164
  )
165
165
  logger.debug(
166
166
  "Fetched and locked #{response.values.flatten.size} new jobs for workers (#{response.keys.join(", ")})."
@@ -226,11 +226,7 @@ module Delayed
226
226
 
227
227
  # otherwise just reconnect and let it retry
228
228
  logger.warn("failed to unlock prefetched jobs - connection terminated; skipping for now")
229
- if Rails.version < "6.1"
230
- ::Delayed::Job.clear_all_connections!
231
- else
232
- ::Delayed::Job.clear_all_connections!(nil)
233
- end
229
+ ::Delayed::Job.clear_all_connections!(nil)
234
230
  end
235
231
  end
236
232
 
@@ -274,8 +270,8 @@ module Delayed
274
270
  @parent_pid && @parent_pid != Process.ppid
275
271
  end
276
272
 
277
- def client_timeout(&block)
278
- Timeout.timeout(@client_timeout, &block)
273
+ def client_timeout(&)
274
+ Timeout.timeout(@client_timeout, &)
279
275
  end
280
276
 
281
277
  ClientState = Struct.new(:working, :socket, :name)
@@ -43,7 +43,7 @@ module Delayed
43
43
  # The unix_server_socket method takes care of cleaning up any existing
44
44
  # socket for us if the work queue process dies and is restarted.
45
45
  listen_socket = Socket.unix_server_socket(@server_address)
46
- Server.new(listen_socket, parent_pid: parent_pid, config: @config)
46
+ Server.new(listen_socket, parent_pid:, config: @config)
47
47
  end
48
48
 
49
49
  def client
@@ -22,7 +22,7 @@ module Delayed
22
22
  if config.keys.any? { |k| CONSUL_CONFIG_KEYS.include?(k) }
23
23
  consul_config = Diplomat::Configuration.new.tap do |conf|
24
24
  CONSUL_CONFIG_KEYS.each do |key|
25
- conf.send("#{key}=", config[key]) if config[key]
25
+ conf.send(:"#{key}=", config[key]) if config[key]
26
26
  end
27
27
  end
28
28
  @service_client = Diplomat::Service.new(configuration: consul_config)
@@ -19,7 +19,7 @@ module Delayed
19
19
  klass = @subclasses.find { |sc| sc.type_name == type }
20
20
  raise ArgumentError, "Unable to build a HealthCheck for type #{type}" unless klass
21
21
 
22
- klass.new(worker_name: worker_name, config: config)
22
+ klass.new(worker_name:, config:)
23
23
  end
24
24
 
25
25
  def reschedule_abandoned_jobs
@@ -9,7 +9,7 @@ module Delayed
9
9
  ALIVE_CHECK_LINUX = '[ -d "/proc/$WORKER_PID" ]'
10
10
  ALIVE_CHECK_MAC = "ps -p $WORKER_PID > /dev/null"
11
11
  ALIVE_CHECK = RUBY_PLATFORM.include?("darwin") ? ALIVE_CHECK_MAC : ALIVE_CHECK_LINUX
12
- SCRIPT_TEMPLATE = <<~SH
12
+ SCRIPT_TEMPLATE = <<~SH.freeze
13
13
  WORKER_PID="%{pid}" # an example, filled from ruby when the check is created
14
14
  ORIGINAL_MTIME="%{mtime}" # an example, filled from ruby when the check is created
15
15
 
@@ -37,7 +37,7 @@ module Delayed
37
37
  end
38
38
 
39
39
  def self.check_script(pid, mtime)
40
- format(SCRIPT_TEMPLATE, { pid: pid, mtime: mtime })
40
+ format(SCRIPT_TEMPLATE, { pid:, mtime: })
41
41
  end
42
42
 
43
43
  def self.process_is_still_running?(pid, mtime)
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "delayed/rails_reloader_plugin"
4
-
5
3
  module Delayed
6
4
  class TimeoutError < RuntimeError; end
7
5
 
@@ -73,7 +71,6 @@ module Delayed
73
71
 
74
72
  @signal_queue = []
75
73
 
76
- plugins << Delayed::RailsReloaderPlugin
77
74
  plugins.each(&:inject!)
78
75
  end
79
76
 
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inst-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.17
4
+ version: 3.1.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
8
8
  - Ethan Vizitei
9
9
  - Jacob Burroughs
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2024-04-23 00:00:00.000000000 Z
13
+ date: 2025-03-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: '6.0'
21
+ version: '7.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: '6.0'
28
+ version: '7.0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: activerecord-pg-extensions
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -46,14 +46,14 @@ dependencies:
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: '6.0'
49
+ version: '7.0'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: '6.0'
56
+ version: '7.0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: after_transaction_commit
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -186,6 +186,20 @@ dependencies:
186
186
  - - "~>"
187
187
  - !ruby/object:Gem::Version
188
188
  version: 2.6.3
189
+ - !ruby/object:Gem::Dependency
190
+ name: mutex_m
191
+ requirement: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ type: :development
197
+ prerelease: false
198
+ version_requirements: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
189
203
  - !ruby/object:Gem::Dependency
190
204
  name: pg
191
205
  requirement: !ruby/object:Gem::Requirement
@@ -290,14 +304,14 @@ dependencies:
290
304
  requirements:
291
305
  - - "~>"
292
306
  - !ruby/object:Gem::Version
293
- version: '2.4'
307
+ version: '3.0'
294
308
  type: :development
295
309
  prerelease: false
296
310
  version_requirements: !ruby/object:Gem::Requirement
297
311
  requirements:
298
312
  - - "~>"
299
313
  - !ruby/object:Gem::Version
300
- version: '2.4'
314
+ version: '3.0'
301
315
  - !ruby/object:Gem::Dependency
302
316
  name: sinatra
303
317
  requirement: !ruby/object:Gem::Requirement
@@ -316,16 +330,16 @@ dependencies:
316
330
  name: sinatra-contrib
317
331
  requirement: !ruby/object:Gem::Requirement
318
332
  requirements:
319
- - - ">="
333
+ - - "~>"
320
334
  - !ruby/object:Gem::Version
321
- version: '0'
335
+ version: '3.1'
322
336
  type: :development
323
337
  prerelease: false
324
338
  version_requirements: !ruby/object:Gem::Requirement
325
339
  requirements:
326
- - - ">="
340
+ - - "~>"
327
341
  - !ruby/object:Gem::Version
328
- version: '0'
342
+ version: '3.1'
329
343
  - !ruby/object:Gem::Dependency
330
344
  name: timecop
331
345
  requirement: !ruby/object:Gem::Requirement
@@ -354,7 +368,7 @@ dependencies:
354
368
  - - ">="
355
369
  - !ruby/object:Gem::Version
356
370
  version: '0'
357
- description:
371
+ description:
358
372
  email:
359
373
  - cody@instructure.com
360
374
  - evizitei@instructure.com
@@ -422,7 +436,6 @@ files:
422
436
  - lib/delayed/periodic.rb
423
437
  - lib/delayed/plugin.rb
424
438
  - lib/delayed/pool.rb
425
- - lib/delayed/rails_reloader_plugin.rb
426
439
  - lib/delayed/server.rb
427
440
  - lib/delayed/server/helpers.rb
428
441
  - lib/delayed/server/public/css/app.css
@@ -448,7 +461,7 @@ homepage: https://github.com/instructure/inst-jobs
448
461
  licenses: []
449
462
  metadata:
450
463
  rubygems_mfa_required: 'true'
451
- post_install_message:
464
+ post_install_message:
452
465
  rdoc_options: []
453
466
  require_paths:
454
467
  - lib
@@ -456,15 +469,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
456
469
  requirements:
457
470
  - - ">="
458
471
  - !ruby/object:Gem::Version
459
- version: '2.7'
472
+ version: '3.1'
460
473
  required_rubygems_version: !ruby/object:Gem::Requirement
461
474
  requirements:
462
475
  - - ">="
463
476
  - !ruby/object:Gem::Version
464
477
  version: '0'
465
478
  requirements: []
466
- rubygems_version: 3.1.6
467
- signing_key:
479
+ rubygems_version: 3.4.19
480
+ signing_key:
468
481
  specification_version: 4
469
482
  summary: Instructure-maintained fork of delayed_job
470
483
  test_files: []
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "delayed/plugin"
4
-
5
- module Delayed
6
- class RailsReloaderPlugin < Plugin
7
- callbacks do |lifecycle|
8
- app = Rails.application
9
- if app && !app.config.cache_classes
10
- lifecycle.around(:perform) do |worker, job, &block|
11
- reload = !app.config.reload_classes_only_on_change || app.reloaders.any?(&:updated?)
12
-
13
- if reload
14
- if defined?(ActiveSupport::Reloader)
15
- Rails.application.reloader.reload!
16
- else
17
- ActionDispatch::Reloader.prepare!
18
- end
19
- end
20
-
21
- begin
22
- block.call(worker, job)
23
- ensure
24
- ActionDispatch::Reloader.cleanup! if reload && !defined?(ActiveSupport::Reloader)
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end