inst-jobs 3.1.5 → 3.1.6
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 +4 -4
- data/lib/delayed/backend/active_record.rb +18 -0
- data/lib/delayed/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz: '
|
|
3
|
+
metadata.gz: e33f94a9740d7ecb8c90f2473450468397ac1c3df195a5c7a957ea7d10861cb1
|
|
4
|
+
data.tar.gz: '0820afd8c1ffde55f0c1ff8ef31ca37e020e8cfe7ae8068aca476473ee4ea5e3'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 10d3bd5fb8193811f144aa094f2d81e1366efe9d476ec5f9b3386637e1f59b8d0c362fed2208f3f5e6f771def087bed5eeb7a04057b098c3ee8d441562d5efe7
|
|
7
|
+
data.tar.gz: d7d8f75f6e4d75b23003a018694dc17973e05a88e0408687deaf64c20cb81174ef65ad1b852aa5e1bed9141f590d107ce694a793229ca23db0180600ab58a602
|
|
@@ -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/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.6
|
|
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-
|
|
13
|
+
date: 2022-10-25 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
|
|
@@ -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: []
|