inst-jobs 1.0.1 → 2.1.0

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.
@@ -107,6 +107,15 @@ RSpec.describe Delayed::Worker::HealthCheck do
107
107
  @dead_job.reload
108
108
  expect(@dead_job.locked_by).to eq 'prefetch:some_node'
109
109
  end
110
+
111
+ it "bails immediately if advisory lock already taken" do
112
+ allow(Delayed::Worker::HealthCheck).to receive(:attempt_advisory_lock).and_return(false)
113
+ Delayed::Worker::HealthCheck.reschedule_abandoned_jobs
114
+ @dead_job.reload
115
+ expect(@dead_job.run_at.to_i).to eq(initial_run_at.to_i)
116
+ expect(@dead_job.locked_at).to_not be_nil
117
+ expect(@dead_job.locked_by).to_not be_nil
118
+ end
110
119
  end
111
120
 
112
121
  describe '#initialize' do
@@ -19,6 +19,19 @@ describe Delayed::Worker do
19
19
  expect(fired).to be_truthy
20
20
  end
21
21
 
22
+ it "uses the retry callback for a retriable exception" do
23
+ error_fired = retry_fired = false
24
+ Delayed::Worker.lifecycle.before(:error) {|worker, exception| error_fired = true }
25
+ Delayed::Worker.lifecycle.before(:retry) {|worker, exception| retry_fired = true}
26
+ job = Delayed::Job.new(payload_object: {}, priority: 25, strand: "test_jobs", max_attempts: 3)
27
+ expect(job).to receive(:invoke_job) do
28
+ raise Delayed::RetriableError, "that's all this job does"
29
+ end
30
+ subject.perform(job)
31
+ expect(error_fired).to be_falsey
32
+ expect(retry_fired).to be_truthy
33
+ end
34
+
22
35
  it "reloads" do
23
36
  fakeApplication = double('Rails.application',
24
37
  config: double('Rails.application.config',
@@ -82,11 +82,11 @@ shared_examples_for 'random ruby objects' do
82
82
  obj = klass.new
83
83
  method = double()
84
84
 
85
- expect(Delayed::PerformableMethod).to receive(:new).with(obj, :test_method, args: [1,2,3], kwargs: {synchronous: true}, on_failure: nil, on_permanent_failure: nil).and_return(method)
85
+ expect(Delayed::PerformableMethod).to receive(:new).with(obj, :test_method, args: [1,2,3], kwargs: {synchronous: true}, on_failure: nil, on_permanent_failure: nil, sender: obj).and_return(method)
86
86
  expect(Delayed::Job).to receive(:enqueue).with(method, :enqueue_arg_1 => :thing)
87
87
  obj.test_method(1,2,3)
88
88
 
89
- expect(Delayed::PerformableMethod).to receive(:new).with(obj, :test_method, args: [4], kwargs: {:synchronous=>true}, on_failure: nil, on_permanent_failure: nil).and_return(method)
89
+ expect(Delayed::PerformableMethod).to receive(:new).with(obj, :test_method, args: [4], kwargs: {:synchronous=>true}, on_failure: nil, on_permanent_failure: nil, sender: obj).and_return(method)
90
90
  expect(Delayed::Job).to receive(:enqueue).with(method, :enqueue_arg_1 => :thing)
91
91
  obj.test_method(4)
92
92
 
@@ -65,4 +65,10 @@ shared_examples_for 'Delayed::PerformableMethod' do
65
65
  p.send(:on_permanent_failure, 'fail_frd')
66
66
  story.text.should == 'fail_frd'
67
67
  end
68
+
69
+ it "can still generate a name with no kwargs" do
70
+ story = Story.create :text => 'wat'
71
+ p = Delayed::PerformableMethod.new(story, :tell, kwargs: nil)
72
+ expect(p.full_name).to eq("Story.find(#{story.id}).tell()")
73
+ end
68
74
  end
@@ -35,6 +35,15 @@ RSpec.configure do |config|
35
35
  end
36
36
  end
37
37
 
38
+ module NoYamlDump
39
+ def encode_with(coder)
40
+ end
41
+ end
42
+ # example groups are often the sender, and if we try to serialize them,
43
+ # the resultant object is then encoded in the sender, and then we serialize
44
+ # again, and it just keeps getting bigger and bigger and bigger...
45
+ RSpec::Core::ExampleGroup.include(NoYamlDump)
46
+
38
47
  ENV['TEST_ENV_NUMBER'] ||= '1'
39
48
  ENV['TEST_DB_HOST'] ||= 'localhost'
40
49
  ENV['TEST_DB_DATABASE'] ||= "inst-jobs-test-#{ENV['TEST_ENV_NUMBER']}"
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: 1.0.1
4
+ version: 2.1.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: 2020-10-28 00:00:00.000000000 Z
12
+ date: 2020-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -325,7 +325,7 @@ dependencies:
325
325
  - - "~>"
326
326
  - !ruby/object:Gem::Version
327
327
  version: 1.4.0
328
- description:
328
+ description:
329
329
  email:
330
330
  - brianp@instructure.com
331
331
  executables:
@@ -412,6 +412,7 @@ files:
412
412
  - spec/delayed/cli_spec.rb
413
413
  - spec/delayed/daemon_spec.rb
414
414
  - spec/delayed/message_sending_spec.rb
415
+ - spec/delayed/periodic_spec.rb
415
416
  - spec/delayed/server_spec.rb
416
417
  - spec/delayed/settings_spec.rb
417
418
  - spec/delayed/work_queue/in_process_spec.rb
@@ -422,15 +423,10 @@ files:
422
423
  - spec/delayed/worker/health_check_spec.rb
423
424
  - spec/delayed/worker_spec.rb
424
425
  - spec/gemfiles/42.gemfile
425
- - spec/gemfiles/42.gemfile.lock
426
426
  - spec/gemfiles/50.gemfile
427
- - spec/gemfiles/50.gemfile.lock
428
427
  - spec/gemfiles/51.gemfile
429
- - spec/gemfiles/51.gemfile.lock
430
428
  - spec/gemfiles/52.gemfile
431
- - spec/gemfiles/52.gemfile.lock
432
429
  - spec/gemfiles/60.gemfile
433
- - spec/gemfiles/60.gemfile.lock
434
430
  - spec/migrate/20140924140513_add_story_table.rb
435
431
  - spec/redis_job_spec.rb
436
432
  - spec/sample_jobs.rb
@@ -445,7 +441,7 @@ files:
445
441
  homepage: https://github.com/instructure/inst-jobs
446
442
  licenses: []
447
443
  metadata: {}
448
- post_install_message:
444
+ post_install_message:
449
445
  rdoc_options: []
450
446
  require_paths:
451
447
  - lib
@@ -453,30 +449,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
453
449
  requirements:
454
450
  - - ">="
455
451
  - !ruby/object:Gem::Version
456
- version: '2.3'
452
+ version: '2.6'
457
453
  required_rubygems_version: !ruby/object:Gem::Requirement
458
454
  requirements:
459
455
  - - ">="
460
456
  - !ruby/object:Gem::Version
461
457
  version: '0'
462
458
  requirements: []
463
- rubygems_version: 3.1.4
464
- signing_key:
459
+ rubygems_version: 3.0.3
460
+ signing_key:
465
461
  specification_version: 4
466
462
  summary: Instructure-maintained fork of delayed_job
467
463
  test_files:
468
464
  - spec/sample_jobs.rb
469
465
  - spec/spec_helper.rb
470
466
  - spec/redis_job_spec.rb
471
- - spec/gemfiles/51.gemfile.lock
472
- - spec/gemfiles/60.gemfile.lock
473
- - spec/gemfiles/42.gemfile.lock
474
- - spec/gemfiles/50.gemfile.lock
475
467
  - spec/gemfiles/60.gemfile
476
468
  - spec/gemfiles/42.gemfile
477
469
  - spec/gemfiles/52.gemfile
478
470
  - spec/gemfiles/50.gemfile
479
- - spec/gemfiles/52.gemfile.lock
480
471
  - spec/gemfiles/51.gemfile
481
472
  - spec/shared_jobs_specs.rb
482
473
  - spec/shared/performable_method.rb
@@ -490,6 +481,7 @@ test_files:
490
481
  - spec/delayed/cli_spec.rb
491
482
  - spec/delayed/daemon_spec.rb
492
483
  - spec/delayed/worker_spec.rb
484
+ - spec/delayed/periodic_spec.rb
493
485
  - spec/delayed/message_sending_spec.rb
494
486
  - spec/delayed/settings_spec.rb
495
487
  - spec/delayed/work_queue/in_process_spec.rb
@@ -1,192 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- inst-jobs (0.15.12)
5
- activerecord (>= 4.2)
6
- activesupport (>= 4.2)
7
- after_transaction_commit (>= 1.0, < 3)
8
- railties (>= 4.2)
9
- redis (> 3.0)
10
- redis-scripting (~> 1.0.1)
11
- rufus-scheduler (~> 3.4, < 3.5)
12
-
13
- GEM
14
- remote: https://rubygems.org/
15
- specs:
16
- actionmailer (4.2.9)
17
- actionpack (= 4.2.9)
18
- actionview (= 4.2.9)
19
- activejob (= 4.2.9)
20
- mail (~> 2.5, >= 2.5.4)
21
- rails-dom-testing (~> 1.0, >= 1.0.5)
22
- actionpack (4.2.9)
23
- actionview (= 4.2.9)
24
- activesupport (= 4.2.9)
25
- rack (~> 1.6)
26
- rack-test (~> 0.6.2)
27
- rails-dom-testing (~> 1.0, >= 1.0.5)
28
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (4.2.9)
30
- activesupport (= 4.2.9)
31
- builder (~> 3.1)
32
- erubis (~> 2.7.0)
33
- rails-dom-testing (~> 1.0, >= 1.0.5)
34
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- activejob (4.2.9)
36
- activesupport (= 4.2.9)
37
- globalid (>= 0.3.0)
38
- activemodel (4.2.9)
39
- activesupport (= 4.2.9)
40
- builder (~> 3.1)
41
- activerecord (4.2.9)
42
- activemodel (= 4.2.9)
43
- activesupport (= 4.2.9)
44
- arel (~> 6.0)
45
- activesupport (4.2.9)
46
- i18n (~> 0.7)
47
- minitest (~> 5.1)
48
- thread_safe (~> 0.3, >= 0.3.4)
49
- tzinfo (~> 1.1)
50
- addressable (2.5.2)
51
- public_suffix (>= 2.0.2, < 4.0)
52
- after_transaction_commit (1.1.2)
53
- activerecord (>= 4.0)
54
- arel (6.0.4)
55
- backports (3.8.0)
56
- builder (3.2.3)
57
- bump (0.5.4)
58
- byebug (9.0.6)
59
- coderay (1.1.1)
60
- concurrent-ruby (1.0.5)
61
- database_cleaner (1.6.1)
62
- diff-lcs (1.3)
63
- erubis (2.7.0)
64
- et-orbi (1.2.1)
65
- tzinfo
66
- globalid (0.4.0)
67
- activesupport (>= 4.2.0)
68
- httpclient (2.8.3)
69
- i18n (0.8.6)
70
- imperium (0.3.0)
71
- addressable (~> 2.5.0)
72
- httpclient (~> 2.8)
73
- loofah (2.0.3)
74
- nokogiri (>= 1.5.9)
75
- mail (2.6.6)
76
- mime-types (>= 1.16, < 4)
77
- method_source (0.8.2)
78
- mime-types (3.1)
79
- mime-types-data (~> 3.2015)
80
- mime-types-data (3.2016.0521)
81
- mini_portile2 (2.4.0)
82
- minitest (5.10.3)
83
- multi_json (1.12.1)
84
- nokogiri (1.10.4)
85
- mini_portile2 (~> 2.4.0)
86
- pg (0.21.0)
87
- pry (0.10.4)
88
- coderay (~> 1.1.0)
89
- method_source (~> 0.8.1)
90
- slop (~> 3.4)
91
- public_suffix (3.0.2)
92
- rack (1.6.8)
93
- rack-protection (1.5.3)
94
- rack
95
- rack-test (0.6.3)
96
- rack (>= 1.0)
97
- rails (4.2.9)
98
- actionmailer (= 4.2.9)
99
- actionpack (= 4.2.9)
100
- actionview (= 4.2.9)
101
- activejob (= 4.2.9)
102
- activemodel (= 4.2.9)
103
- activerecord (= 4.2.9)
104
- activesupport (= 4.2.9)
105
- bundler (>= 1.3.0, < 2.0)
106
- railties (= 4.2.9)
107
- sprockets-rails
108
- rails-deprecated_sanitizer (1.0.3)
109
- activesupport (>= 4.2.0.alpha)
110
- rails-dom-testing (1.0.8)
111
- activesupport (>= 4.2.0.beta, < 5.0)
112
- nokogiri (~> 1.6)
113
- rails-deprecated_sanitizer (>= 1.0.1)
114
- rails-html-sanitizer (1.0.3)
115
- loofah (~> 2.0)
116
- railties (4.2.9)
117
- actionpack (= 4.2.9)
118
- activesupport (= 4.2.9)
119
- rake (>= 0.8.7)
120
- thor (>= 0.18.1, < 2.0)
121
- rake (12.0.0)
122
- redis (4.1.2)
123
- redis-scripting (1.0.1)
124
- redis (>= 3.0)
125
- rspec (3.8.0)
126
- rspec-core (~> 3.8.0)
127
- rspec-expectations (~> 3.8.0)
128
- rspec-mocks (~> 3.8.0)
129
- rspec-core (3.8.2)
130
- rspec-support (~> 3.8.0)
131
- rspec-expectations (3.8.4)
132
- diff-lcs (>= 1.2.0, < 2.0)
133
- rspec-support (~> 3.8.0)
134
- rspec-mocks (3.8.1)
135
- diff-lcs (>= 1.2.0, < 2.0)
136
- rspec-support (~> 3.8.0)
137
- rspec-support (3.8.2)
138
- rufus-scheduler (3.4.2)
139
- et-orbi (~> 1.0)
140
- sinatra (1.4.8)
141
- rack (~> 1.5)
142
- rack-protection (~> 1.4)
143
- tilt (>= 1.3, < 3)
144
- sinatra-contrib (1.4.7)
145
- backports (>= 2.0)
146
- multi_json
147
- rack-protection
148
- rack-test
149
- sinatra (~> 1.4.0)
150
- tilt (>= 1.3, < 3)
151
- slop (3.6.0)
152
- sprockets (3.7.1)
153
- concurrent-ruby (~> 1.0)
154
- rack (> 1, < 3)
155
- sprockets-rails (3.2.0)
156
- actionpack (>= 4.0)
157
- activesupport (>= 4.0)
158
- sprockets (>= 3.0.0)
159
- test_after_commit (0.4.1)
160
- activerecord (>= 3.2)
161
- thor (0.19.4)
162
- thread_safe (0.3.6)
163
- tilt (2.0.8)
164
- timecop (0.7.1)
165
- tzinfo (1.2.3)
166
- thread_safe (~> 0.1)
167
- wwtd (1.3.0)
168
-
169
- PLATFORMS
170
- ruby
171
-
172
- DEPENDENCIES
173
- after_transaction_commit (< 2)
174
- bump
175
- byebug
176
- database_cleaner (= 1.6.1)
177
- imperium (>= 0.2.3)
178
- inst-jobs!
179
- pg (< 1.0)
180
- pry
181
- rack-test
182
- rails (~> 4.2.5)
183
- rake
184
- rspec (~> 3.8.0)
185
- sinatra
186
- sinatra-contrib
187
- test_after_commit (= 0.4.1)
188
- timecop (= 0.7.1)
189
- wwtd (~> 1.3.0)
190
-
191
- BUNDLED WITH
192
- 1.17.2
@@ -1,197 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- inst-jobs (0.15.12)
5
- activerecord (>= 4.2)
6
- activesupport (>= 4.2)
7
- after_transaction_commit (>= 1.0, < 3)
8
- railties (>= 4.2)
9
- redis (> 3.0)
10
- redis-scripting (~> 1.0.1)
11
- rufus-scheduler (~> 3.4, < 3.5)
12
-
13
- GEM
14
- remote: https://rubygems.org/
15
- specs:
16
- actioncable (5.0.5)
17
- actionpack (= 5.0.5)
18
- nio4r (>= 1.2, < 3.0)
19
- websocket-driver (~> 0.6.1)
20
- actionmailer (5.0.5)
21
- actionpack (= 5.0.5)
22
- actionview (= 5.0.5)
23
- activejob (= 5.0.5)
24
- mail (~> 2.5, >= 2.5.4)
25
- rails-dom-testing (~> 2.0)
26
- actionpack (5.0.5)
27
- actionview (= 5.0.5)
28
- activesupport (= 5.0.5)
29
- rack (~> 2.0)
30
- rack-test (~> 0.6.3)
31
- rails-dom-testing (~> 2.0)
32
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
33
- actionview (5.0.5)
34
- activesupport (= 5.0.5)
35
- builder (~> 3.1)
36
- erubis (~> 2.7.0)
37
- rails-dom-testing (~> 2.0)
38
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
39
- activejob (5.0.5)
40
- activesupport (= 5.0.5)
41
- globalid (>= 0.3.6)
42
- activemodel (5.0.5)
43
- activesupport (= 5.0.5)
44
- activerecord (5.0.5)
45
- activemodel (= 5.0.5)
46
- activesupport (= 5.0.5)
47
- arel (~> 7.0)
48
- activesupport (5.0.5)
49
- concurrent-ruby (~> 1.0, >= 1.0.2)
50
- i18n (~> 0.7)
51
- minitest (~> 5.1)
52
- tzinfo (~> 1.1)
53
- addressable (2.6.0)
54
- public_suffix (>= 2.0.2, < 4.0)
55
- after_transaction_commit (2.0.0)
56
- activerecord (>= 5.0)
57
- arel (7.1.4)
58
- backports (3.8.0)
59
- builder (3.2.3)
60
- bump (0.5.4)
61
- byebug (9.0.6)
62
- coderay (1.1.1)
63
- concurrent-ruby (1.0.5)
64
- database_cleaner (1.6.1)
65
- diff-lcs (1.3)
66
- erubis (2.7.0)
67
- et-orbi (1.2.1)
68
- tzinfo
69
- globalid (0.4.0)
70
- activesupport (>= 4.2.0)
71
- httpclient (2.8.3)
72
- i18n (0.8.6)
73
- imperium (0.5.1)
74
- addressable (~> 2.5)
75
- httpclient (~> 2.8)
76
- loofah (2.0.3)
77
- nokogiri (>= 1.5.9)
78
- mail (2.6.6)
79
- mime-types (>= 1.16, < 4)
80
- method_source (0.8.2)
81
- mime-types (3.1)
82
- mime-types-data (~> 3.2015)
83
- mime-types-data (3.2016.0521)
84
- mini_portile2 (2.4.0)
85
- minitest (5.10.3)
86
- multi_json (1.12.1)
87
- mustermann (1.0.0.beta2)
88
- nio4r (2.1.0)
89
- nokogiri (1.10.4)
90
- mini_portile2 (~> 2.4.0)
91
- pg (0.21.0)
92
- pry (0.10.4)
93
- coderay (~> 1.1.0)
94
- method_source (~> 0.8.1)
95
- slop (~> 3.4)
96
- public_suffix (3.1.1)
97
- rack (2.0.3)
98
- rack-protection (2.0.0.beta2)
99
- rack
100
- rack-test (0.6.3)
101
- rack (>= 1.0)
102
- rails (5.0.5)
103
- actioncable (= 5.0.5)
104
- actionmailer (= 5.0.5)
105
- actionpack (= 5.0.5)
106
- actionview (= 5.0.5)
107
- activejob (= 5.0.5)
108
- activemodel (= 5.0.5)
109
- activerecord (= 5.0.5)
110
- activesupport (= 5.0.5)
111
- bundler (>= 1.3.0)
112
- railties (= 5.0.5)
113
- sprockets-rails (>= 2.0.0)
114
- rails-dom-testing (2.0.3)
115
- activesupport (>= 4.2.0)
116
- nokogiri (>= 1.6)
117
- rails-html-sanitizer (1.0.3)
118
- loofah (~> 2.0)
119
- railties (5.0.5)
120
- actionpack (= 5.0.5)
121
- activesupport (= 5.0.5)
122
- method_source
123
- rake (>= 0.8.7)
124
- thor (>= 0.18.1, < 2.0)
125
- rake (12.0.0)
126
- redis (4.1.2)
127
- redis-scripting (1.0.1)
128
- redis (>= 3.0)
129
- rspec (3.8.0)
130
- rspec-core (~> 3.8.0)
131
- rspec-expectations (~> 3.8.0)
132
- rspec-mocks (~> 3.8.0)
133
- rspec-core (3.8.2)
134
- rspec-support (~> 3.8.0)
135
- rspec-expectations (3.8.4)
136
- diff-lcs (>= 1.2.0, < 2.0)
137
- rspec-support (~> 3.8.0)
138
- rspec-mocks (3.8.1)
139
- diff-lcs (>= 1.2.0, < 2.0)
140
- rspec-support (~> 3.8.0)
141
- rspec-support (3.8.2)
142
- rufus-scheduler (3.4.2)
143
- et-orbi (~> 1.0)
144
- sinatra (2.0.0.beta2)
145
- mustermann (= 1.0.0.beta2)
146
- rack (~> 2.0)
147
- rack-protection (= 2.0.0.beta2)
148
- tilt (~> 2.0)
149
- sinatra-contrib (2.0.0.beta2)
150
- backports (>= 2.0)
151
- multi_json
152
- mustermann (= 1.0.0.beta2)
153
- rack-protection (= 2.0.0.beta2)
154
- rack-test
155
- sinatra (= 2.0.0.beta2)
156
- tilt (>= 1.3, < 3)
157
- slop (3.6.0)
158
- sprockets (3.7.1)
159
- concurrent-ruby (~> 1.0)
160
- rack (> 1, < 3)
161
- sprockets-rails (3.2.0)
162
- actionpack (>= 4.0)
163
- activesupport (>= 4.0)
164
- sprockets (>= 3.0.0)
165
- thor (0.19.4)
166
- thread_safe (0.3.6)
167
- tilt (2.0.8)
168
- timecop (0.7.1)
169
- tzinfo (1.2.3)
170
- thread_safe (~> 0.1)
171
- websocket-driver (0.6.5)
172
- websocket-extensions (>= 0.1.0)
173
- websocket-extensions (0.1.2)
174
- wwtd (1.3.0)
175
-
176
- PLATFORMS
177
- ruby
178
-
179
- DEPENDENCIES
180
- bump
181
- byebug
182
- database_cleaner (= 1.6.1)
183
- imperium (>= 0.2.3)
184
- inst-jobs!
185
- pg (< 1.0)
186
- pry
187
- rack-test
188
- rails (~> 5.0.0)
189
- rake
190
- rspec (~> 3.8.0)
191
- sinatra (= 2.0.0.beta2)
192
- sinatra-contrib (= 2.0.0.beta2)
193
- timecop (= 0.7.1)
194
- wwtd (~> 1.3.0)
195
-
196
- BUNDLED WITH
197
- 1.17.2