switchman-inst-jobs 4.0.5 → 4.0.8
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/db/migrate/20220328152900_add_failed_jobs_indicies.rb +12 -0
- data/db/migrate/20220519204546_add_requeued_job_id_to_failed_jobs.rb +7 -0
- data/lib/switchman_inst_jobs/delayed/backend/active_record/abstract_job.rb +3 -1
- data/lib/switchman_inst_jobs/delayed/backend/base.rb +1 -1
- data/lib/switchman_inst_jobs/delayed/message_sending.rb +1 -0
- data/lib/switchman_inst_jobs/jobs_migrator.rb +12 -3
- data/lib/switchman_inst_jobs/version.rb +1 -1
- metadata +27 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b220157fed7508b8f0412dcb44e31af64ae36f7752d0b9740376c910be115fe6
|
4
|
+
data.tar.gz: b35f1e9f59dab46393e6ff037f9c05d6b8f107bfd9a811a943865f4334785515
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fda1eb1f28deca4430edf8a37ec4c3b10e5323aa854d5358e887aa971b5f2d4c5ff8660e8e08aee24b850358ed2084c1532d72c053dcccf4bf8f23a565038cd2
|
7
|
+
data.tar.gz: abf4cf28af1cea47c438ca5215d24dd5aac4978ccd14f3d7f9d9a91f8b1f1bdce05b96c159961c238afd20d4ef9383d51ef40d198c7e9294672716d3123b3b58
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddFailedJobsIndicies < ActiveRecord::Migration[5.2]
|
4
|
+
disable_ddl_transaction!
|
5
|
+
|
6
|
+
def change
|
7
|
+
add_index :failed_jobs, :failed_at, algorithm: :concurrently
|
8
|
+
add_index :failed_jobs, :strand, where: 'strand IS NOT NULL', algorithm: :concurrently
|
9
|
+
add_index :failed_jobs, :singleton, where: 'singleton IS NOT NULL', algorithm: :concurrently
|
10
|
+
add_index :failed_jobs, :tag, algorithm: :concurrently
|
11
|
+
end
|
12
|
+
end
|
@@ -6,7 +6,9 @@ module SwitchmanInstJobs
|
|
6
6
|
module ClassMethods
|
7
7
|
def current_switchman_shard
|
8
8
|
connected_to_stack.reverse_each do |hash|
|
9
|
-
|
9
|
+
if hash[:switchman_shard] && hash[:klasses].include?(connection_class_for_self)
|
10
|
+
return hash[:switchman_shard]
|
11
|
+
end
|
10
12
|
end
|
11
13
|
|
12
14
|
::ActiveRecord::Base.current_switchman_shard.delayed_jobs_shard
|
@@ -14,7 +14,7 @@ module SwitchmanInstJobs
|
|
14
14
|
module ClassMethods
|
15
15
|
def enqueue(object, **options)
|
16
16
|
::Switchman::Shard.periodic_clear_shard_cache
|
17
|
-
current_shard = ::Switchman::Shard.current
|
17
|
+
current_shard = options[:current_shard] || ::Switchman::Shard.current
|
18
18
|
enqueue_options = options.merge(
|
19
19
|
current_shard: current_shard
|
20
20
|
)
|
@@ -127,7 +127,13 @@ module SwitchmanInstJobs
|
|
127
127
|
# the lock ensures the blocker always gets unlocked
|
128
128
|
first = value_scope.where.not(locked_by: nil).next_in_strand_order.lock.first
|
129
129
|
if first
|
130
|
-
create_blocker_job(
|
130
|
+
create_blocker_job(
|
131
|
+
queue: first.queue,
|
132
|
+
shard_id: first.shard_id,
|
133
|
+
**{ column => value },
|
134
|
+
**blocker_job_kwargs
|
135
|
+
)
|
136
|
+
|
131
137
|
# the rest of 3) is taken care of here
|
132
138
|
# make sure that all the jobs moved over are NOT next in strand
|
133
139
|
::Delayed::Job.where(next_in_strand: true, locked_by: nil, **{ column => value }).
|
@@ -160,12 +166,15 @@ module SwitchmanInstJobs
|
|
160
166
|
locked_by: ::Delayed::Backend::Base::ON_HOLD_BLOCKER
|
161
167
|
}
|
162
168
|
|
169
|
+
quoted_function_name = ::Delayed::Job.connection.quote_table_name('half_md5_as_bigint')
|
163
170
|
strand_advisory_lock_fn = lambda do |value|
|
164
|
-
::Delayed::Job.connection.execute("SELECT pg_advisory_xact_lock(
|
171
|
+
::Delayed::Job.connection.execute("SELECT pg_advisory_xact_lock(#{quoted_function_name}('#{value}'))")
|
165
172
|
end
|
166
173
|
|
167
174
|
singleton_advisory_lock_fn = lambda do |value|
|
168
|
-
::Delayed::Job.connection.execute(
|
175
|
+
::Delayed::Job.connection.execute(
|
176
|
+
"SELECT pg_advisory_xact_lock(#{quoted_function_name}('singleton:#{value}'))"
|
177
|
+
)
|
169
178
|
end
|
170
179
|
|
171
180
|
handler.call(strand_scope, :strand, {}, strand_advisory_lock_fn)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: switchman-inst-jobs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Petty
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inst-jobs
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
version: '6.1'
|
54
54
|
- - "<"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '
|
56
|
+
version: '7.1'
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -63,27 +63,35 @@ dependencies:
|
|
63
63
|
version: '6.1'
|
64
64
|
- - "<"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
66
|
+
version: '7.1'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: switchman
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '3.
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: 3.0.7
|
73
|
+
version: '3.1'
|
77
74
|
type: :runtime
|
78
75
|
prerelease: false
|
79
76
|
version_requirements: !ruby/object:Gem::Requirement
|
80
77
|
requirements:
|
81
78
|
- - "~>"
|
82
79
|
- !ruby/object:Gem::Version
|
83
|
-
version: '3.
|
84
|
-
|
80
|
+
version: '3.1'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: appraisal
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 2.3.0
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
85
93
|
- !ruby/object:Gem::Version
|
86
|
-
version: 3.0
|
94
|
+
version: 2.3.0
|
87
95
|
- !ruby/object:Gem::Dependency
|
88
96
|
name: bundler
|
89
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -280,21 +288,7 @@ dependencies:
|
|
280
288
|
- - "~>"
|
281
289
|
- !ruby/object:Gem::Version
|
282
290
|
version: '0.21'
|
283
|
-
|
284
|
-
name: wwtd
|
285
|
-
requirement: !ruby/object:Gem::Requirement
|
286
|
-
requirements:
|
287
|
-
- - "~>"
|
288
|
-
- !ruby/object:Gem::Version
|
289
|
-
version: '1.4'
|
290
|
-
type: :development
|
291
|
-
prerelease: false
|
292
|
-
version_requirements: !ruby/object:Gem::Requirement
|
293
|
-
requirements:
|
294
|
-
- - "~>"
|
295
|
-
- !ruby/object:Gem::Version
|
296
|
-
version: '1.4'
|
297
|
-
description:
|
291
|
+
description:
|
298
292
|
email:
|
299
293
|
- bpetty@instructure.com
|
300
294
|
executables: []
|
@@ -344,6 +338,8 @@ files:
|
|
344
338
|
- db/migrate/20220128084800_update_insert_trigger_for_singleton_unique_constraint_change.rb
|
345
339
|
- db/migrate/20220128084900_update_delete_trigger_for_singleton_unique_constraint_change.rb
|
346
340
|
- db/migrate/20220203063200_remove_old_singleton_index.rb
|
341
|
+
- db/migrate/20220328152900_add_failed_jobs_indicies.rb
|
342
|
+
- db/migrate/20220519204546_add_requeued_job_id_to_failed_jobs.rb
|
347
343
|
- lib/switchman-inst-jobs.rb
|
348
344
|
- lib/switchman_inst_jobs.rb
|
349
345
|
- lib/switchman_inst_jobs/active_record/connection_adapters/postgresql_adapter.rb
|
@@ -371,7 +367,7 @@ licenses:
|
|
371
367
|
metadata:
|
372
368
|
allowed_push_host: https://rubygems.org
|
373
369
|
rubygems_mfa_required: 'true'
|
374
|
-
post_install_message:
|
370
|
+
post_install_message:
|
375
371
|
rdoc_options: []
|
376
372
|
require_paths:
|
377
373
|
- lib
|
@@ -379,15 +375,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
379
375
|
requirements:
|
380
376
|
- - ">="
|
381
377
|
- !ruby/object:Gem::Version
|
382
|
-
version: '2.
|
378
|
+
version: '2.7'
|
383
379
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
384
380
|
requirements:
|
385
381
|
- - ">="
|
386
382
|
- !ruby/object:Gem::Version
|
387
383
|
version: '0'
|
388
384
|
requirements: []
|
389
|
-
rubygems_version: 3.1.
|
390
|
-
signing_key:
|
385
|
+
rubygems_version: 3.1.6
|
386
|
+
signing_key:
|
391
387
|
specification_version: 4
|
392
388
|
summary: Switchman and Instructure Jobs compatibility gem.
|
393
389
|
test_files: []
|