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 +4 -4
- data/lib/delayed/backend/active_record.rb +18 -0
- data/lib/delayed/backend/base.rb +1 -1
- data/lib/delayed/batch.rb +1 -1
- data/lib/delayed/message_sending.rb +1 -1
- data/lib/delayed/version.rb +1 -1
- 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: 0475c3b076cb2d06a380ab5439899071d7b242f0b984efc656c07cdac42a30ef
|
4
|
+
data.tar.gz: 6b327fe5fa9e90ff3e0a9cc6fbbf3bf141fac324999c7b3fe4b86c60196ddab0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
data/lib/delayed/backend/base.rb
CHANGED
data/lib/delayed/batch.rb
CHANGED
data/lib/delayed/version.rb
CHANGED
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.
|
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:
|
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.
|
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.
|
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.
|
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: []
|