inst-jobs 3.1.5 → 3.1.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: 5adf88a85cf490a4fee0b3e8b5234be47b0f70034f6a89489ace8a132c74886d
4
- data.tar.gz: '07836a394917c38fcb1cba64a9a1988f3c949bb7e147247f759da8f860382a7f'
3
+ metadata.gz: 0475c3b076cb2d06a380ab5439899071d7b242f0b984efc656c07cdac42a30ef
4
+ data.tar.gz: 6b327fe5fa9e90ff3e0a9cc6fbbf3bf141fac324999c7b3fe4b86c60196ddab0
5
5
  SHA512:
6
- metadata.gz: 8fc62248de29a57be2044a0949299ac26475df434c4906f0786293bb07b3a7bf63fb1c2b79c3e230e992825984e76417eb9ad221a46bac5c78b92d305c2db638
7
- data.tar.gz: 44a04dcfd05ecad3345bd9da25909711912edaaf16e9f6a502859765319de33e0a59ac840571b5f5e543b76ce40b43550ab9a750e56753c60c29886002894201
6
+ metadata.gz: fc255ab122c9744ba5222125898d43d12e668d091c5ad7f034693e5ce6d224be21c107caf67261d3bdef03b55f481baa4d0d3912e3c9bff8e1039d8ff12f3f35
7
+ data.tar.gz: 6a7d73a994637c0241d54da38e98a8c25008345622b9410a867da603740c6eb8133e7bb1d36e8dd62d479148e7bf43bc5e0ea0f1a59f63dd1f0b8a7763467e19
@@ -320,6 +320,24 @@ module Delayed
320
320
  scope.order(Arel.sql("COUNT(tag) DESC")).count.map { |t, c| { tag: t, count: c } }
321
321
  end
322
322
 
323
+ # given a scope of non-stranded queued jobs, apply a temporary strand to throttle their execution
324
+ # returns [job_count, new_strand]
325
+ # (this is designed for use in a Rails console or the Canvas Jobs interface)
326
+ def self.apply_temp_strand!(job_scope, max_concurrent: 1)
327
+ if job_scope.where("strand IS NOT NULL OR singleton IS NOT NULL").exists?
328
+ raise ArgumentError, "can't apply strand to already stranded jobs"
329
+ end
330
+
331
+ job_count = 0
332
+ new_strand = "tmp_strand_#{SecureRandom.alphanumeric(16)}"
333
+ ::Delayed::Job.transaction do
334
+ job_count = job_scope.update_all(strand: new_strand, max_concurrent: max_concurrent, next_in_strand: false)
335
+ ::Delayed::Job.where(strand: new_strand).order(:id).limit(max_concurrent).update_all(next_in_strand: true)
336
+ end
337
+
338
+ [job_count, new_strand]
339
+ end
340
+
323
341
  def self.maybe_silence_periodic_log(&block)
324
342
  if Settings.silence_periodic_log
325
343
  ::ActiveRecord::Base.logger.silence(&block)
@@ -269,7 +269,7 @@ module Delayed
269
269
  end
270
270
 
271
271
  def payload_object
272
- @payload_object ||= deserialize(self["handler"].untaint)
272
+ @payload_object ||= deserialize(self["handler"])
273
273
  end
274
274
 
275
275
  def name
data/lib/delayed/batch.rb CHANGED
@@ -44,7 +44,7 @@ module Delayed
44
44
  Delayed::Job.batches = nil
45
45
  batch_args = opts.slice(:priority)
46
46
  batches.each do |enqueue_args, batch|
47
- next if batch.size.zero?
47
+ next if batch.empty?
48
48
 
49
49
  if batch.size == 1
50
50
  args = batch.first.merge(batch_args)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "debug_inspector" if ::Rails.env.test? || ::Rails.env.development?
3
+ require "debug_inspector" if Rails.env.test? || Rails.env.development?
4
4
 
5
5
  module Delayed
6
6
  module MessageSending
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Delayed
4
- VERSION = "3.1.5"
4
+ VERSION = "3.1.7"
5
5
  end
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.5
4
+ version: 3.1.7
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: 2022-07-07 00:00:00.000000000 Z
13
+ date: 2023-01-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -192,14 +192,14 @@ dependencies:
192
192
  requirements:
193
193
  - - "~>"
194
194
  - !ruby/object:Gem::Version
195
- version: 2.5.1
195
+ version: 2.6.3
196
196
  type: :development
197
197
  prerelease: false
198
198
  version_requirements: !ruby/object:Gem::Requirement
199
199
  requirements:
200
200
  - - "~>"
201
201
  - !ruby/object:Gem::Version
202
- version: 2.5.1
202
+ version: 2.6.3
203
203
  - !ruby/object:Gem::Dependency
204
204
  name: pg
205
205
  requirement: !ruby/object:Gem::Requirement
@@ -410,7 +410,7 @@ dependencies:
410
410
  - - ">="
411
411
  - !ruby/object:Gem::Version
412
412
  version: '0'
413
- description:
413
+ description:
414
414
  email:
415
415
  - cody@instructure.com
416
416
  - evizitei@instructure.com
@@ -504,7 +504,7 @@ homepage: https://github.com/instructure/inst-jobs
504
504
  licenses: []
505
505
  metadata:
506
506
  rubygems_mfa_required: 'true'
507
- post_install_message:
507
+ post_install_message:
508
508
  rdoc_options: []
509
509
  require_paths:
510
510
  - lib
@@ -512,7 +512,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
512
512
  requirements:
513
513
  - - ">="
514
514
  - !ruby/object:Gem::Version
515
- version: '2.6'
515
+ version: '2.7'
516
516
  required_rubygems_version: !ruby/object:Gem::Requirement
517
517
  requirements:
518
518
  - - ">="
@@ -520,7 +520,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
520
520
  version: '0'
521
521
  requirements: []
522
522
  rubygems_version: 3.1.6
523
- signing_key:
523
+ signing_key:
524
524
  specification_version: 4
525
525
  summary: Instructure-maintained fork of delayed_job
526
526
  test_files: []