inst-jobs 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/db/migrate/20101216224513_create_delayed_jobs.rb +9 -7
- data/db/migrate/20110531144916_cleanup_delayed_jobs_indexes.rb +8 -13
- data/db/migrate/20110610213249_optimize_delayed_jobs.rb +8 -8
- data/db/migrate/20110831210257_add_delayed_jobs_next_in_strand.rb +25 -25
- data/db/migrate/20120510004759_delayed_jobs_delete_trigger_lock_for_update.rb +4 -8
- data/db/migrate/20120531150712_drop_psql_jobs_pop_fn.rb +1 -3
- data/db/migrate/20120607164022_delayed_jobs_use_advisory_locks.rb +11 -15
- data/db/migrate/20120607181141_index_jobs_on_locked_by.rb +1 -1
- data/db/migrate/20120608191051_add_jobs_run_at_index.rb +2 -2
- data/db/migrate/20120927184213_change_delayed_jobs_handler_to_text.rb +1 -1
- data/db/migrate/20140505215510_copy_failed_jobs_original_id.rb +2 -3
- data/db/migrate/20150807133223_add_max_concurrent_to_jobs.rb +9 -13
- data/db/migrate/20151210162949_improve_max_concurrent.rb +4 -8
- data/db/migrate/20161206323555_add_back_default_string_limits_jobs.rb +3 -2
- data/db/migrate/20181217155351_speed_up_max_concurrent_triggers.rb +13 -17
- data/db/migrate/20200330230722_add_id_to_get_delayed_jobs_index.rb +8 -8
- data/db/migrate/20200824222232_speed_up_max_concurrent_delete_trigger.rb +72 -77
- data/db/migrate/20200825011002_add_strand_order_override.rb +93 -97
- data/db/migrate/20210809145804_add_n_strand_index.rb +12 -0
- data/db/migrate/20210812210128_add_singleton_column.rb +200 -0
- data/db/migrate/20210917232626_add_delete_conflicting_singletons_before_unlock_trigger.rb +27 -0
- data/db/migrate/20210928174754_fix_singleton_condition_in_before_insert.rb +56 -0
- data/db/migrate/20210929204903_update_conflicting_singleton_function_to_use_index.rb +27 -0
- data/exe/inst_jobs +3 -2
- data/lib/delayed/backend/active_record.rb +211 -168
- data/lib/delayed/backend/base.rb +110 -72
- data/lib/delayed/batch.rb +11 -9
- data/lib/delayed/cli.rb +98 -84
- data/lib/delayed/core_ext/kernel.rb +4 -2
- data/lib/delayed/daemon.rb +70 -74
- data/lib/delayed/job_tracking.rb +26 -25
- data/lib/delayed/lifecycle.rb +27 -23
- data/lib/delayed/log_tailer.rb +17 -17
- data/lib/delayed/logging.rb +13 -16
- data/lib/delayed/message_sending.rb +43 -52
- data/lib/delayed/performable_method.rb +6 -8
- data/lib/delayed/periodic.rb +72 -68
- data/lib/delayed/plugin.rb +2 -4
- data/lib/delayed/pool.rb +205 -168
- data/lib/delayed/server/helpers.rb +6 -6
- data/lib/delayed/server.rb +51 -54
- data/lib/delayed/settings.rb +94 -81
- data/lib/delayed/testing.rb +21 -22
- data/lib/delayed/version.rb +1 -1
- data/lib/delayed/work_queue/in_process.rb +21 -17
- data/lib/delayed/work_queue/parent_process/client.rb +55 -53
- data/lib/delayed/work_queue/parent_process/server.rb +245 -207
- data/lib/delayed/work_queue/parent_process.rb +52 -53
- data/lib/delayed/worker/consul_health_check.rb +32 -33
- data/lib/delayed/worker/health_check.rb +34 -26
- data/lib/delayed/worker/null_health_check.rb +3 -1
- data/lib/delayed/worker/process_helper.rb +8 -9
- data/lib/delayed/worker.rb +272 -241
- data/lib/delayed/yaml_extensions.rb +12 -10
- data/lib/delayed_job.rb +37 -37
- data/lib/inst-jobs.rb +1 -1
- data/spec/active_record_job_spec.rb +143 -139
- data/spec/delayed/cli_spec.rb +7 -7
- data/spec/delayed/daemon_spec.rb +10 -9
- data/spec/delayed/message_sending_spec.rb +16 -9
- data/spec/delayed/periodic_spec.rb +14 -21
- data/spec/delayed/server_spec.rb +38 -38
- data/spec/delayed/settings_spec.rb +26 -25
- data/spec/delayed/work_queue/in_process_spec.rb +7 -8
- data/spec/delayed/work_queue/parent_process/client_spec.rb +17 -12
- data/spec/delayed/work_queue/parent_process/server_spec.rb +117 -41
- data/spec/delayed/work_queue/parent_process_spec.rb +21 -23
- data/spec/delayed/worker/consul_health_check_spec.rb +37 -50
- data/spec/delayed/worker/health_check_spec.rb +60 -52
- data/spec/delayed/worker_spec.rb +44 -21
- data/spec/sample_jobs.rb +45 -15
- data/spec/shared/delayed_batch.rb +74 -67
- data/spec/shared/delayed_method.rb +143 -102
- data/spec/shared/performable_method.rb +39 -38
- data/spec/shared/shared_backend.rb +550 -437
- data/spec/shared/testing.rb +14 -14
- data/spec/shared/worker.rb +156 -148
- data/spec/shared_jobs_specs.rb +13 -13
- data/spec/spec_helper.rb +53 -55
- metadata +148 -82
- data/lib/delayed/backend/redis/bulk_update.lua +0 -50
- data/lib/delayed/backend/redis/destroy_job.lua +0 -2
- data/lib/delayed/backend/redis/enqueue.lua +0 -29
- data/lib/delayed/backend/redis/fail_job.lua +0 -5
- data/lib/delayed/backend/redis/find_available.lua +0 -3
- data/lib/delayed/backend/redis/functions.rb +0 -59
- data/lib/delayed/backend/redis/get_and_lock_next_available.lua +0 -17
- data/lib/delayed/backend/redis/includes/jobs_common.lua +0 -203
- data/lib/delayed/backend/redis/job.rb +0 -535
- data/lib/delayed/backend/redis/set_running.lua +0 -5
- data/lib/delayed/backend/redis/tickle_strand.lua +0 -2
- data/spec/gemfiles/42.gemfile +0 -7
- data/spec/gemfiles/50.gemfile +0 -7
- data/spec/gemfiles/51.gemfile +0 -7
- data/spec/gemfiles/52.gemfile +0 -7
- data/spec/gemfiles/60.gemfile +0 -7
- data/spec/redis_job_spec.rb +0 -148
data/spec/spec_helper.rb
CHANGED
@@ -1,105 +1,103 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "delayed_job"
|
4
|
+
require "delayed/testing"
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require 'byebug'
|
6
|
+
require "database_cleaner"
|
7
|
+
require "fileutils"
|
8
|
+
require "rack/test"
|
9
|
+
require "timecop"
|
10
|
+
require "webmock/rspec"
|
12
11
|
|
13
|
-
|
12
|
+
require "pry"
|
13
|
+
require "byebug"
|
14
14
|
|
15
|
+
RSpec.configure do |config|
|
15
16
|
config.expect_with(:rspec) do |c|
|
16
|
-
c.syntax = [
|
17
|
+
c.syntax = %i[should expect]
|
17
18
|
end
|
18
19
|
|
19
20
|
config.before(:suite) do
|
20
21
|
DatabaseCleaner.strategy = :transaction
|
21
22
|
DatabaseCleaner.clean_with(:truncation)
|
23
|
+
WebMock.disable_net_connect!
|
22
24
|
end
|
23
25
|
|
24
|
-
config.before
|
25
|
-
if
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
config.before do |example|
|
27
|
+
DatabaseCleaner.strategy = if example.metadata[:sinatra] || example.metadata[:non_transactional]
|
28
|
+
:truncation
|
29
|
+
else
|
30
|
+
:transaction
|
31
|
+
end
|
30
32
|
DatabaseCleaner.start
|
31
33
|
end
|
32
34
|
|
33
|
-
config.after
|
35
|
+
config.after do
|
34
36
|
DatabaseCleaner.clean
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
38
40
|
module NoYamlDump
|
39
|
-
def encode_with(coder)
|
40
|
-
end
|
41
|
+
def encode_with(coder); end
|
41
42
|
end
|
42
43
|
# example groups are often the sender, and if we try to serialize them,
|
43
44
|
# the resultant object is then encoded in the sender, and then we serialize
|
44
45
|
# again, and it just keeps getting bigger and bigger and bigger...
|
45
46
|
RSpec::Core::ExampleGroup.include(NoYamlDump)
|
46
47
|
|
47
|
-
ENV[
|
48
|
-
ENV[
|
49
|
-
ENV[
|
50
|
-
ENV['TEST_REDIS_CONNECTION'] ||= 'redis://localhost:6379/'
|
51
|
-
|
52
|
-
Delayed::Backend::Redis::Job.redis = Redis.new(url: ENV['TEST_REDIS_CONNECTION'])
|
53
|
-
Delayed::Backend::Redis::Job.redis.select ENV['TEST_ENV_NUMBER']
|
48
|
+
ENV["TEST_ENV_NUMBER"] ||= "1"
|
49
|
+
ENV["TEST_DB_HOST"] ||= "localhost"
|
50
|
+
ENV["TEST_DB_DATABASE"] ||= "inst-jobs-test-#{ENV['TEST_ENV_NUMBER']}"
|
54
51
|
|
55
52
|
connection_config = {
|
56
53
|
adapter: :postgresql,
|
57
|
-
host: ENV[
|
58
|
-
encoding:
|
59
|
-
username: ENV[
|
60
|
-
database: ENV[
|
54
|
+
host: ENV["TEST_DB_HOST"].presence,
|
55
|
+
encoding: "utf8",
|
56
|
+
username: ENV["TEST_DB_USERNAME"],
|
57
|
+
database: ENV["TEST_DB_DATABASE"]
|
61
58
|
}
|
62
59
|
|
63
|
-
if ::Rails.version < '5'
|
64
|
-
class ActiveRecord::Migration
|
65
|
-
class << self
|
66
|
-
def [](_version); self; end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
60
|
def migrate(file)
|
72
|
-
|
73
|
-
ActiveRecord::Migrator.migrate(file)
|
74
|
-
elsif ::Rails.version >= '6'
|
75
|
-
ActiveRecord::MigrationContext.new(file, ActiveRecord::SchemaMigration).migrate
|
76
|
-
else
|
77
|
-
ActiveRecord::MigrationContext.new(file).migrate
|
78
|
-
end
|
61
|
+
ActiveRecord::MigrationContext.new(file, ActiveRecord::SchemaMigration).migrate
|
79
62
|
end
|
80
63
|
|
81
64
|
# create the test db if it does not exist, to help out wwtd
|
82
|
-
ActiveRecord::Base.establish_connection(connection_config.merge(database:
|
65
|
+
ActiveRecord::Base.establish_connection(connection_config.merge(database: "postgres"))
|
83
66
|
begin
|
84
67
|
ActiveRecord::Base.connection.create_database(connection_config[:database])
|
85
68
|
rescue ActiveRecord::StatementInvalid
|
69
|
+
nil
|
86
70
|
end
|
87
71
|
ActiveRecord::Base.establish_connection(connection_config)
|
88
|
-
|
72
|
+
|
73
|
+
# we need to ensure this callback is called for activerecord-pg-extensions,
|
74
|
+
# which isn't running because we're not using Rails to setup the database
|
75
|
+
ActiveRecord::PGExtensions::Railtie.run_initializers
|
76
|
+
|
77
|
+
# TODO: reset db and migrate again, to test migrations
|
89
78
|
|
90
79
|
migrate("db/migrate")
|
91
80
|
migrate("spec/migrate")
|
92
81
|
Delayed::Backend::ActiveRecord::Job.reset_column_information
|
93
82
|
Delayed::Backend::ActiveRecord::Job::Failed.reset_column_information
|
94
83
|
|
95
|
-
Time.zone =
|
96
|
-
|
84
|
+
Time.zone = "UTC" # rubocop:disable Rails/TimeZoneAssignment
|
85
|
+
FileUtils.mkdir_p("tmp")
|
86
|
+
ActiveRecord::Base.logger = Rails.logger = Logger.new("tmp/test.log")
|
97
87
|
|
98
88
|
# Purely useful for test cases...
|
99
89
|
class Story < ActiveRecord::Base
|
100
|
-
def tell
|
101
|
-
|
102
|
-
|
90
|
+
def tell
|
91
|
+
text
|
92
|
+
end
|
93
|
+
|
94
|
+
def whatever(times, _)
|
95
|
+
tell * times
|
96
|
+
end
|
97
|
+
|
98
|
+
def whatever_else(times, _)
|
99
|
+
tell * times
|
100
|
+
end
|
103
101
|
|
104
102
|
handle_asynchronously :whatever
|
105
103
|
handle_asynchronously :whatever_else, queue: "testqueue"
|
@@ -122,7 +120,7 @@ module MyReverser
|
|
122
120
|
end
|
123
121
|
|
124
122
|
def change_setting(klass, setting_name, value)
|
125
|
-
old_val = klass.
|
123
|
+
old_val = klass.send(setting_name)
|
126
124
|
klass.send("#{setting_name}=", value)
|
127
125
|
yield
|
128
126
|
ensure
|
@@ -133,5 +131,5 @@ def run_job(job)
|
|
133
131
|
Delayed::Testing.run_job(job)
|
134
132
|
end
|
135
133
|
|
136
|
-
|
137
|
-
|
134
|
+
require_relative "sample_jobs"
|
135
|
+
require_relative "shared_jobs_specs"
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inst-jobs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Luetke
|
8
8
|
- Brian Palmer
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -17,28 +17,42 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '6.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '6.0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: activerecord-pg-extensions
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0.4'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0.4'
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: activesupport
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
31
45
|
requirements:
|
32
46
|
- - ">="
|
33
47
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
48
|
+
version: '6.0'
|
35
49
|
type: :runtime
|
36
50
|
prerelease: false
|
37
51
|
version_requirements: !ruby/object:Gem::Requirement
|
38
52
|
requirements:
|
39
53
|
- - ">="
|
40
54
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
55
|
+
version: '6.0'
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: after_transaction_commit
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,75 +74,61 @@ dependencies:
|
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '3'
|
62
76
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '4.2'
|
69
|
-
type: :runtime
|
70
|
-
prerelease: false
|
71
|
-
version_requirements: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '4.2'
|
76
|
-
- !ruby/object:Gem::Dependency
|
77
|
-
name: redis
|
77
|
+
name: debug_inspector
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '1.0'
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '1.0'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
|
-
name:
|
91
|
+
name: fugit
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: '1.3'
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
103
|
+
version: '1.3'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
|
-
name:
|
105
|
+
name: railties
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '6.0'
|
111
111
|
type: :runtime
|
112
112
|
prerelease: false
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '6.0'
|
118
118
|
- !ruby/object:Gem::Dependency
|
119
|
-
name:
|
119
|
+
name: appraisal
|
120
120
|
requirement: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
125
|
-
type: :
|
124
|
+
version: '2.4'
|
125
|
+
type: :development
|
126
126
|
prerelease: false
|
127
127
|
version_requirements: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '2.4'
|
132
132
|
- !ruby/object:Gem::Dependency
|
133
133
|
name: bump
|
134
134
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,44 +161,58 @@ dependencies:
|
|
161
161
|
name: database_cleaner
|
162
162
|
requirement: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
166
|
+
version: '2.0'
|
167
167
|
type: :development
|
168
168
|
prerelease: false
|
169
169
|
version_requirements: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: '2.0'
|
174
174
|
- !ruby/object:Gem::Dependency
|
175
|
-
name:
|
175
|
+
name: database_cleaner-active_record
|
176
176
|
requirement: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - "
|
178
|
+
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0
|
180
|
+
version: '2.0'
|
181
181
|
type: :development
|
182
182
|
prerelease: false
|
183
183
|
version_requirements: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- - "
|
185
|
+
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 0
|
187
|
+
version: '2.0'
|
188
|
+
- !ruby/object:Gem::Dependency
|
189
|
+
name: diplomat
|
190
|
+
requirement: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 2.5.1
|
195
|
+
type: :development
|
196
|
+
prerelease: false
|
197
|
+
version_requirements: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 2.5.1
|
188
202
|
- !ruby/object:Gem::Dependency
|
189
203
|
name: pg
|
190
204
|
requirement: !ruby/object:Gem::Requirement
|
191
205
|
requirements:
|
192
|
-
- - "
|
206
|
+
- - ">="
|
193
207
|
- !ruby/object:Gem::Version
|
194
|
-
version: '
|
208
|
+
version: '0'
|
195
209
|
type: :development
|
196
210
|
prerelease: false
|
197
211
|
version_requirements: !ruby/object:Gem::Requirement
|
198
212
|
requirements:
|
199
|
-
- - "
|
213
|
+
- - ">="
|
200
214
|
- !ruby/object:Gem::Version
|
201
|
-
version: '
|
215
|
+
version: '0'
|
202
216
|
- !ruby/object:Gem::Dependency
|
203
217
|
name: pry
|
204
218
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,14 +275,70 @@ dependencies:
|
|
261
275
|
requirements:
|
262
276
|
- - "~>"
|
263
277
|
- !ruby/object:Gem::Version
|
264
|
-
version: 3.
|
278
|
+
version: '3.10'
|
279
|
+
type: :development
|
280
|
+
prerelease: false
|
281
|
+
version_requirements: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - "~>"
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '3.10'
|
286
|
+
- !ruby/object:Gem::Dependency
|
287
|
+
name: rubocop
|
288
|
+
requirement: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - "~>"
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '1.19'
|
293
|
+
type: :development
|
294
|
+
prerelease: false
|
295
|
+
version_requirements: !ruby/object:Gem::Requirement
|
296
|
+
requirements:
|
297
|
+
- - "~>"
|
298
|
+
- !ruby/object:Gem::Version
|
299
|
+
version: '1.19'
|
300
|
+
- !ruby/object:Gem::Dependency
|
301
|
+
name: rubocop-rails
|
302
|
+
requirement: !ruby/object:Gem::Requirement
|
303
|
+
requirements:
|
304
|
+
- - "~>"
|
305
|
+
- !ruby/object:Gem::Version
|
306
|
+
version: '2.11'
|
265
307
|
type: :development
|
266
308
|
prerelease: false
|
267
309
|
version_requirements: !ruby/object:Gem::Requirement
|
268
310
|
requirements:
|
269
311
|
- - "~>"
|
270
312
|
- !ruby/object:Gem::Version
|
271
|
-
version:
|
313
|
+
version: '2.11'
|
314
|
+
- !ruby/object:Gem::Dependency
|
315
|
+
name: rubocop-rake
|
316
|
+
requirement: !ruby/object:Gem::Requirement
|
317
|
+
requirements:
|
318
|
+
- - "~>"
|
319
|
+
- !ruby/object:Gem::Version
|
320
|
+
version: '0.6'
|
321
|
+
type: :development
|
322
|
+
prerelease: false
|
323
|
+
version_requirements: !ruby/object:Gem::Requirement
|
324
|
+
requirements:
|
325
|
+
- - "~>"
|
326
|
+
- !ruby/object:Gem::Version
|
327
|
+
version: '0.6'
|
328
|
+
- !ruby/object:Gem::Dependency
|
329
|
+
name: rubocop-rspec
|
330
|
+
requirement: !ruby/object:Gem::Requirement
|
331
|
+
requirements:
|
332
|
+
- - "~>"
|
333
|
+
- !ruby/object:Gem::Version
|
334
|
+
version: '2.4'
|
335
|
+
type: :development
|
336
|
+
prerelease: false
|
337
|
+
version_requirements: !ruby/object:Gem::Requirement
|
338
|
+
requirements:
|
339
|
+
- - "~>"
|
340
|
+
- !ruby/object:Gem::Version
|
341
|
+
version: '2.4'
|
272
342
|
- !ruby/object:Gem::Dependency
|
273
343
|
name: sinatra
|
274
344
|
requirement: !ruby/object:Gem::Requirement
|
@@ -303,14 +373,28 @@ dependencies:
|
|
303
373
|
requirements:
|
304
374
|
- - '='
|
305
375
|
- !ruby/object:Gem::Version
|
306
|
-
version: 0.
|
376
|
+
version: 0.9.4
|
307
377
|
type: :development
|
308
378
|
prerelease: false
|
309
379
|
version_requirements: !ruby/object:Gem::Requirement
|
310
380
|
requirements:
|
311
381
|
- - '='
|
312
382
|
- !ruby/object:Gem::Version
|
313
|
-
version: 0.
|
383
|
+
version: 0.9.4
|
384
|
+
- !ruby/object:Gem::Dependency
|
385
|
+
name: webmock
|
386
|
+
requirement: !ruby/object:Gem::Requirement
|
387
|
+
requirements:
|
388
|
+
- - ">="
|
389
|
+
- !ruby/object:Gem::Version
|
390
|
+
version: '0'
|
391
|
+
type: :development
|
392
|
+
prerelease: false
|
393
|
+
version_requirements: !ruby/object:Gem::Requirement
|
394
|
+
requirements:
|
395
|
+
- - ">="
|
396
|
+
- !ruby/object:Gem::Version
|
397
|
+
version: '0'
|
314
398
|
- !ruby/object:Gem::Dependency
|
315
399
|
name: wwtd
|
316
400
|
requirement: !ruby/object:Gem::Requirement
|
@@ -325,7 +409,7 @@ dependencies:
|
|
325
409
|
- - "~>"
|
326
410
|
- !ruby/object:Gem::Version
|
327
411
|
version: 1.4.0
|
328
|
-
description:
|
412
|
+
description:
|
329
413
|
email:
|
330
414
|
- brianp@instructure.com
|
331
415
|
executables:
|
@@ -359,20 +443,14 @@ files:
|
|
359
443
|
- db/migrate/20200330230722_add_id_to_get_delayed_jobs_index.rb
|
360
444
|
- db/migrate/20200824222232_speed_up_max_concurrent_delete_trigger.rb
|
361
445
|
- db/migrate/20200825011002_add_strand_order_override.rb
|
446
|
+
- db/migrate/20210809145804_add_n_strand_index.rb
|
447
|
+
- db/migrate/20210812210128_add_singleton_column.rb
|
448
|
+
- db/migrate/20210917232626_add_delete_conflicting_singletons_before_unlock_trigger.rb
|
449
|
+
- db/migrate/20210928174754_fix_singleton_condition_in_before_insert.rb
|
450
|
+
- db/migrate/20210929204903_update_conflicting_singleton_function_to_use_index.rb
|
362
451
|
- exe/inst_jobs
|
363
452
|
- lib/delayed/backend/active_record.rb
|
364
453
|
- lib/delayed/backend/base.rb
|
365
|
-
- lib/delayed/backend/redis/bulk_update.lua
|
366
|
-
- lib/delayed/backend/redis/destroy_job.lua
|
367
|
-
- lib/delayed/backend/redis/enqueue.lua
|
368
|
-
- lib/delayed/backend/redis/fail_job.lua
|
369
|
-
- lib/delayed/backend/redis/find_available.lua
|
370
|
-
- lib/delayed/backend/redis/functions.rb
|
371
|
-
- lib/delayed/backend/redis/get_and_lock_next_available.lua
|
372
|
-
- lib/delayed/backend/redis/includes/jobs_common.lua
|
373
|
-
- lib/delayed/backend/redis/job.rb
|
374
|
-
- lib/delayed/backend/redis/set_running.lua
|
375
|
-
- lib/delayed/backend/redis/tickle_strand.lua
|
376
454
|
- lib/delayed/batch.rb
|
377
455
|
- lib/delayed/cli.rb
|
378
456
|
- lib/delayed/core_ext/kernel.rb
|
@@ -422,13 +500,7 @@ files:
|
|
422
500
|
- spec/delayed/worker/consul_health_check_spec.rb
|
423
501
|
- spec/delayed/worker/health_check_spec.rb
|
424
502
|
- spec/delayed/worker_spec.rb
|
425
|
-
- spec/gemfiles/42.gemfile
|
426
|
-
- spec/gemfiles/50.gemfile
|
427
|
-
- spec/gemfiles/51.gemfile
|
428
|
-
- spec/gemfiles/52.gemfile
|
429
|
-
- spec/gemfiles/60.gemfile
|
430
503
|
- spec/migrate/20140924140513_add_story_table.rb
|
431
|
-
- spec/redis_job_spec.rb
|
432
504
|
- spec/sample_jobs.rb
|
433
505
|
- spec/shared/delayed_batch.rb
|
434
506
|
- spec/shared/delayed_method.rb
|
@@ -441,7 +513,7 @@ files:
|
|
441
513
|
homepage: https://github.com/instructure/inst-jobs
|
442
514
|
licenses: []
|
443
515
|
metadata: {}
|
444
|
-
post_install_message:
|
516
|
+
post_install_message:
|
445
517
|
rdoc_options: []
|
446
518
|
require_paths:
|
447
519
|
- lib
|
@@ -456,19 +528,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
456
528
|
- !ruby/object:Gem::Version
|
457
529
|
version: '0'
|
458
530
|
requirements: []
|
459
|
-
rubygems_version: 3.
|
460
|
-
signing_key:
|
531
|
+
rubygems_version: 3.2.24
|
532
|
+
signing_key:
|
461
533
|
specification_version: 4
|
462
534
|
summary: Instructure-maintained fork of delayed_job
|
463
535
|
test_files:
|
464
536
|
- spec/sample_jobs.rb
|
465
537
|
- spec/spec_helper.rb
|
466
|
-
- spec/redis_job_spec.rb
|
467
|
-
- spec/gemfiles/60.gemfile
|
468
|
-
- spec/gemfiles/42.gemfile
|
469
|
-
- spec/gemfiles/52.gemfile
|
470
|
-
- spec/gemfiles/50.gemfile
|
471
|
-
- spec/gemfiles/51.gemfile
|
472
538
|
- spec/shared_jobs_specs.rb
|
473
539
|
- spec/shared/performable_method.rb
|
474
540
|
- spec/shared/testing.rb
|
@@ -1,50 +0,0 @@
|
|
1
|
-
local action, id_string, flavor, query, now = unpack(ARGV)
|
2
|
-
|
3
|
-
local ids = {}
|
4
|
-
|
5
|
-
if string.len(flavor) > 0 then
|
6
|
-
if flavor == 'current' then
|
7
|
-
ids = redis.call('ZRANGE', Keys.queue(query), 0, -1)
|
8
|
-
elseif flavor == 'future' then
|
9
|
-
ids = redis.call('ZRANGE', Keys.future_queue(query), 0, -1)
|
10
|
-
elseif flavor == 'strand' then
|
11
|
-
ids = redis.call('LRANGE', Keys.strand(query), 0, -1)
|
12
|
-
elseif flavor == 'tag' then
|
13
|
-
ids = redis.call('SMEMBERS', Keys.tag(query))
|
14
|
-
end
|
15
|
-
else
|
16
|
-
-- can't pass an array to redis/lua, so we split the string here
|
17
|
-
for id in string.gmatch(id_string, "([%w-]+)") do
|
18
|
-
if job_exists(id) then
|
19
|
-
table.insert(ids, id)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
local count = 0
|
25
|
-
for idx, job_id in ipairs(ids) do
|
26
|
-
if action == 'hold' then
|
27
|
-
local queue, strand, locked_by = unpack(redis.call('HMGET', Keys.job(job_id), 'queue', 'strand', 'locked_by'))
|
28
|
-
if not locked_by then
|
29
|
-
count = count + 1
|
30
|
-
remove_from_queues(job_id, queue, strand)
|
31
|
-
redis.call('HMSET', Keys.job(job_id), 'locked_at', now, 'locked_by', 'on hold', 'attempts', 50)
|
32
|
-
end
|
33
|
-
elseif action == 'unhold' then
|
34
|
-
local queue, locked_by = unpack(redis.call('HMGET', Keys.job(job_id), 'queue', 'locked_by'))
|
35
|
-
if locked_by == 'on hold' then
|
36
|
-
count = count + 1
|
37
|
-
add_to_queues(job_id, queue, now)
|
38
|
-
redis.call('HDEL', Keys.job(job_id), 'locked_at', 'locked_by')
|
39
|
-
redis.call('HMSET', Keys.job(job_id), 'attempts', 0)
|
40
|
-
end
|
41
|
-
elseif action == 'destroy' then
|
42
|
-
local locked_by = redis.call('HGET', Keys.job(job_id), 'locked_by')
|
43
|
-
if not locked_by or locked_by == 'on hold' then
|
44
|
-
count = count + 1
|
45
|
-
destroy_job(job_id, now)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
return count
|
@@ -1,29 +0,0 @@
|
|
1
|
-
local job_id, queue, strand, now, for_singleton = unpack(ARGV)
|
2
|
-
local strand_key = Keys.strand(strand)
|
3
|
-
|
4
|
-
-- if this is a singleton job, only queue it up if another doesn't exist on the strand
|
5
|
-
-- otherwise, delete it and return the other job id
|
6
|
-
if for_singleton then
|
7
|
-
local job_ids = redis.call('LRANGE', strand_key, 0, 1)
|
8
|
-
local job_to_check = 1
|
9
|
-
if job_exists(job_ids[1]) and redis.call('HGET', Keys.job(job_ids[1]), 'locked_at') then
|
10
|
-
job_to_check = 2
|
11
|
-
end
|
12
|
-
|
13
|
-
local job_to_check_id = job_ids[job_to_check]
|
14
|
-
if job_exists(job_to_check_id) then
|
15
|
-
-- delete the new job, we found a match
|
16
|
-
redis.call('DEL', Keys.job(job_id))
|
17
|
-
return job_to_check_id
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
-- if this job is in a strand, add it to the strand queue first
|
22
|
-
-- if it's not at the front of the strand, we won't enqueue it below
|
23
|
-
if strand_key then
|
24
|
-
add_to_strand(job_id, strand)
|
25
|
-
end
|
26
|
-
|
27
|
-
add_to_queues(job_id, queue, now)
|
28
|
-
|
29
|
-
return job_id
|