inst-jobs 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,10 +20,6 @@ RSpec.describe Delayed::Server, sinatra: true do
20
20
  Delayed.select_backend(Delayed::Backend::ActiveRecord::Job)
21
21
  end
22
22
 
23
- after :all do
24
- Delayed.send(:remove_const, :Job)
25
- end
26
-
27
23
  describe "get '/running'" do
28
24
  before do
29
25
  3.times do |i|
@@ -7,10 +7,6 @@ RSpec.describe Delayed::WorkQueue::InProcess do
7
7
  Delayed.select_backend(Delayed::Backend::ActiveRecord::Job)
8
8
  end
9
9
 
10
- after :all do
11
- Delayed.send(:remove_const, :Job)
12
- end
13
-
14
10
  after :each do
15
11
  Delayed::Worker.lifecycle.reset!
16
12
  end
@@ -16,10 +16,6 @@ RSpec.describe Delayed::WorkQueue::ParentProcess::Client do
16
16
  Delayed.select_backend(Delayed::Backend::ActiveRecord::Job)
17
17
  end
18
18
 
19
- after :all do
20
- Delayed.send(:remove_const, :Job)
21
- end
22
-
23
19
  it 'marshals the given arguments to the server and returns the response' do
24
20
  expect(addrinfo).to receive(:connect).once.and_return(connection)
25
21
  expect(connection).to receive(:eof?).and_return(false)
@@ -31,7 +31,6 @@ RSpec.describe Delayed::WorkQueue::ParentProcess::Server do
31
31
  end
32
32
 
33
33
  after :all do
34
- Delayed.send(:remove_const, :Job)
35
34
  Delayed::Settings.parent_process = {}
36
35
  end
37
36
 
@@ -13,7 +13,6 @@ RSpec.describe Delayed::WorkQueue::ParentProcess do
13
13
  end
14
14
 
15
15
  after :all do
16
- Delayed.send(:remove_const, :Job)
17
16
  Delayed::Settings.parent_process = {}
18
17
  end
19
18
 
@@ -17,7 +17,7 @@ RSpec.describe Delayed::Worker::ConsulHealthCheck do
17
17
 
18
18
  describe '#initialize' do
19
19
  it 'must use the default agent client when the config is mostly empty' do
20
- check = Delayed::Worker::ConsulHealthCheck.new({worker_name: 'foobar'})
20
+ check = Delayed::Worker::ConsulHealthCheck.new(worker_name: 'foobar')
21
21
  expect(check.agent_client).to eq Imperium::Agent.default_client
22
22
  end
23
23
 
@@ -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
@@ -7,10 +7,6 @@ describe 'Delayed::Backend::Redis::Job' do
7
7
  Delayed.select_backend(Delayed::Backend::Redis::Job)
8
8
  end
9
9
 
10
- after :all do
11
- Delayed.send(:remove_const, :Job)
12
- end
13
-
14
10
  before do
15
11
  Delayed::Testing.clear_all!
16
12
  end
@@ -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.0
4
+ version: 2.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: 2020-10-26 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
@@ -115,6 +115,20 @@ dependencies:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '1.3'
118
+ - !ruby/object:Gem::Dependency
119
+ name: debug_inspector
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.0.3
125
+ type: :runtime
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.0.3
118
132
  - !ruby/object:Gem::Dependency
119
133
  name: bump
120
134
  requirement: !ruby/object:Gem::Requirement
@@ -311,7 +325,7 @@ dependencies:
311
325
  - - "~>"
312
326
  - !ruby/object:Gem::Version
313
327
  version: 1.4.0
314
- description:
328
+ description:
315
329
  email:
316
330
  - brianp@instructure.com
317
331
  executables:
@@ -361,6 +375,7 @@ files:
361
375
  - lib/delayed/backend/redis/tickle_strand.lua
362
376
  - lib/delayed/batch.rb
363
377
  - lib/delayed/cli.rb
378
+ - lib/delayed/core_ext/kernel.rb
364
379
  - lib/delayed/daemon.rb
365
380
  - lib/delayed/engine.rb
366
381
  - lib/delayed/job_tracking.rb
@@ -396,6 +411,8 @@ files:
396
411
  - spec/active_record_job_spec.rb
397
412
  - spec/delayed/cli_spec.rb
398
413
  - spec/delayed/daemon_spec.rb
414
+ - spec/delayed/message_sending_spec.rb
415
+ - spec/delayed/periodic_spec.rb
399
416
  - spec/delayed/server_spec.rb
400
417
  - spec/delayed/settings_spec.rb
401
418
  - spec/delayed/work_queue/in_process_spec.rb
@@ -406,15 +423,10 @@ files:
406
423
  - spec/delayed/worker/health_check_spec.rb
407
424
  - spec/delayed/worker_spec.rb
408
425
  - spec/gemfiles/42.gemfile
409
- - spec/gemfiles/42.gemfile.lock
410
426
  - spec/gemfiles/50.gemfile
411
- - spec/gemfiles/50.gemfile.lock
412
427
  - spec/gemfiles/51.gemfile
413
- - spec/gemfiles/51.gemfile.lock
414
428
  - spec/gemfiles/52.gemfile
415
- - spec/gemfiles/52.gemfile.lock
416
429
  - spec/gemfiles/60.gemfile
417
- - spec/gemfiles/60.gemfile.lock
418
430
  - spec/migrate/20140924140513_add_story_table.rb
419
431
  - spec/redis_job_spec.rb
420
432
  - spec/sample_jobs.rb
@@ -429,7 +441,7 @@ files:
429
441
  homepage: https://github.com/instructure/inst-jobs
430
442
  licenses: []
431
443
  metadata: {}
432
- post_install_message:
444
+ post_install_message:
433
445
  rdoc_options: []
434
446
  require_paths:
435
447
  - lib
@@ -437,30 +449,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
437
449
  requirements:
438
450
  - - ">="
439
451
  - !ruby/object:Gem::Version
440
- version: '2.3'
452
+ version: '2.6'
441
453
  required_rubygems_version: !ruby/object:Gem::Requirement
442
454
  requirements:
443
455
  - - ">="
444
456
  - !ruby/object:Gem::Version
445
457
  version: '0'
446
458
  requirements: []
447
- rubygems_version: 3.1.4
448
- signing_key:
459
+ rubygems_version: 3.0.3
460
+ signing_key:
449
461
  specification_version: 4
450
462
  summary: Instructure-maintained fork of delayed_job
451
463
  test_files:
452
464
  - spec/sample_jobs.rb
453
465
  - spec/spec_helper.rb
454
466
  - spec/redis_job_spec.rb
455
- - spec/gemfiles/51.gemfile.lock
456
- - spec/gemfiles/60.gemfile.lock
457
- - spec/gemfiles/42.gemfile.lock
458
- - spec/gemfiles/50.gemfile.lock
459
467
  - spec/gemfiles/60.gemfile
460
468
  - spec/gemfiles/42.gemfile
461
469
  - spec/gemfiles/52.gemfile
462
470
  - spec/gemfiles/50.gemfile
463
- - spec/gemfiles/52.gemfile.lock
464
471
  - spec/gemfiles/51.gemfile
465
472
  - spec/shared_jobs_specs.rb
466
473
  - spec/shared/performable_method.rb
@@ -474,6 +481,8 @@ test_files:
474
481
  - spec/delayed/cli_spec.rb
475
482
  - spec/delayed/daemon_spec.rb
476
483
  - spec/delayed/worker_spec.rb
484
+ - spec/delayed/periodic_spec.rb
485
+ - spec/delayed/message_sending_spec.rb
477
486
  - spec/delayed/settings_spec.rb
478
487
  - spec/delayed/work_queue/in_process_spec.rb
479
488
  - spec/delayed/work_queue/parent_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