inst-jobs 2.3.3 → 2.4.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/db/migrate/20101216224513_create_delayed_jobs.rb +9 -7
  3. data/db/migrate/20110531144916_cleanup_delayed_jobs_indexes.rb +8 -13
  4. data/db/migrate/20110610213249_optimize_delayed_jobs.rb +8 -8
  5. data/db/migrate/20110831210257_add_delayed_jobs_next_in_strand.rb +25 -25
  6. data/db/migrate/20120510004759_delayed_jobs_delete_trigger_lock_for_update.rb +4 -8
  7. data/db/migrate/20120531150712_drop_psql_jobs_pop_fn.rb +1 -3
  8. data/db/migrate/20120607164022_delayed_jobs_use_advisory_locks.rb +11 -15
  9. data/db/migrate/20120607181141_index_jobs_on_locked_by.rb +1 -1
  10. data/db/migrate/20120608191051_add_jobs_run_at_index.rb +2 -2
  11. data/db/migrate/20120927184213_change_delayed_jobs_handler_to_text.rb +1 -1
  12. data/db/migrate/20140505215510_copy_failed_jobs_original_id.rb +2 -3
  13. data/db/migrate/20150807133223_add_max_concurrent_to_jobs.rb +9 -13
  14. data/db/migrate/20151210162949_improve_max_concurrent.rb +4 -8
  15. data/db/migrate/20161206323555_add_back_default_string_limits_jobs.rb +3 -2
  16. data/db/migrate/20181217155351_speed_up_max_concurrent_triggers.rb +13 -17
  17. data/db/migrate/20200330230722_add_id_to_get_delayed_jobs_index.rb +8 -8
  18. data/db/migrate/20200824222232_speed_up_max_concurrent_delete_trigger.rb +72 -77
  19. data/db/migrate/20200825011002_add_strand_order_override.rb +93 -97
  20. data/db/migrate/20210809145804_add_n_strand_index.rb +3 -3
  21. data/db/migrate/20210812210128_add_singleton_column.rb +200 -0
  22. data/db/migrate/20210917232626_add_delete_conflicting_singletons_before_unlock_trigger.rb +27 -0
  23. data/db/migrate/20210928174754_fix_singleton_condition_in_before_insert.rb +56 -0
  24. data/exe/inst_jobs +3 -2
  25. data/lib/delayed/backend/active_record.rb +204 -150
  26. data/lib/delayed/backend/base.rb +106 -82
  27. data/lib/delayed/batch.rb +11 -9
  28. data/lib/delayed/cli.rb +98 -84
  29. data/lib/delayed/core_ext/kernel.rb +4 -2
  30. data/lib/delayed/daemon.rb +70 -74
  31. data/lib/delayed/job_tracking.rb +26 -25
  32. data/lib/delayed/lifecycle.rb +27 -24
  33. data/lib/delayed/log_tailer.rb +17 -17
  34. data/lib/delayed/logging.rb +13 -16
  35. data/lib/delayed/message_sending.rb +43 -52
  36. data/lib/delayed/performable_method.rb +6 -8
  37. data/lib/delayed/periodic.rb +72 -65
  38. data/lib/delayed/plugin.rb +2 -4
  39. data/lib/delayed/pool.rb +198 -193
  40. data/lib/delayed/server/helpers.rb +6 -6
  41. data/lib/delayed/server.rb +51 -54
  42. data/lib/delayed/settings.rb +93 -81
  43. data/lib/delayed/testing.rb +21 -22
  44. data/lib/delayed/version.rb +1 -1
  45. data/lib/delayed/work_queue/in_process.rb +21 -18
  46. data/lib/delayed/work_queue/parent_process/client.rb +54 -55
  47. data/lib/delayed/work_queue/parent_process/server.rb +219 -208
  48. data/lib/delayed/work_queue/parent_process.rb +52 -53
  49. data/lib/delayed/worker/consul_health_check.rb +21 -19
  50. data/lib/delayed/worker/health_check.rb +29 -22
  51. data/lib/delayed/worker/null_health_check.rb +3 -1
  52. data/lib/delayed/worker/process_helper.rb +8 -9
  53. data/lib/delayed/worker.rb +271 -265
  54. data/lib/delayed/yaml_extensions.rb +12 -10
  55. data/lib/delayed_job.rb +37 -38
  56. data/lib/inst-jobs.rb +1 -1
  57. data/spec/active_record_job_spec.rb +129 -136
  58. data/spec/delayed/cli_spec.rb +7 -7
  59. data/spec/delayed/daemon_spec.rb +10 -9
  60. data/spec/delayed/message_sending_spec.rb +16 -9
  61. data/spec/delayed/periodic_spec.rb +13 -12
  62. data/spec/delayed/server_spec.rb +38 -38
  63. data/spec/delayed/settings_spec.rb +26 -25
  64. data/spec/delayed/work_queue/in_process_spec.rb +7 -8
  65. data/spec/delayed/work_queue/parent_process/client_spec.rb +17 -12
  66. data/spec/delayed/work_queue/parent_process/server_spec.rb +70 -41
  67. data/spec/delayed/work_queue/parent_process_spec.rb +21 -23
  68. data/spec/delayed/worker/consul_health_check_spec.rb +22 -22
  69. data/spec/delayed/worker/health_check_spec.rb +60 -52
  70. data/spec/delayed/worker_spec.rb +28 -25
  71. data/spec/sample_jobs.rb +45 -15
  72. data/spec/shared/delayed_batch.rb +74 -67
  73. data/spec/shared/delayed_method.rb +143 -102
  74. data/spec/shared/performable_method.rb +39 -38
  75. data/spec/shared/shared_backend.rb +547 -441
  76. data/spec/shared/testing.rb +14 -14
  77. data/spec/shared/worker.rb +155 -147
  78. data/spec/shared_jobs_specs.rb +13 -13
  79. data/spec/spec_helper.rb +46 -41
  80. metadata +79 -55
  81. data/lib/delayed/backend/redis/bulk_update.lua +0 -50
  82. data/lib/delayed/backend/redis/destroy_job.lua +0 -2
  83. data/lib/delayed/backend/redis/enqueue.lua +0 -29
  84. data/lib/delayed/backend/redis/fail_job.lua +0 -5
  85. data/lib/delayed/backend/redis/find_available.lua +0 -3
  86. data/lib/delayed/backend/redis/functions.rb +0 -59
  87. data/lib/delayed/backend/redis/get_and_lock_next_available.lua +0 -17
  88. data/lib/delayed/backend/redis/includes/jobs_common.lua +0 -203
  89. data/lib/delayed/backend/redis/job.rb +0 -528
  90. data/lib/delayed/backend/redis/set_running.lua +0 -5
  91. data/lib/delayed/backend/redis/tickle_strand.lua +0 -2
  92. data/spec/gemfiles/52.gemfile +0 -7
  93. data/spec/gemfiles/60.gemfile +0 -7
  94. data/spec/gemfiles/60.gemfile.lock +0 -246
  95. data/spec/gemfiles/61.gemfile +0 -7
  96. data/spec/redis_job_spec.rb +0 -148
@@ -1,73 +1,74 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- shared_examples_for 'Delayed::PerformableMethod' do
4
-
5
- it "should not ignore ActiveRecord::RecordNotFound errors because they are not always permanent" do
6
- story = Story.create :text => 'Once upon...'
3
+ shared_examples_for "Delayed::PerformableMethod" do
4
+ it "does not ignore ActiveRecord::RecordNotFound errors because they are not always permanent" do
5
+ story = Story.create text: "Once upon..."
7
6
  p = Delayed::PerformableMethod.new(story, :tell)
8
7
  story.destroy
9
- lambda { YAML.load(p.to_yaml) }.should raise_error(Delayed::Backend::RecordNotFound)
8
+ expect { YAML.load(p.to_yaml) }.to raise_error(Delayed::Backend::RecordNotFound)
10
9
  end
11
10
 
12
- it "should store the object using native YAML even if its an active record" do
13
- story = Story.create :text => 'Once upon...'
11
+ it "stores the object using native YAML even if its an active record" do
12
+ story = Story.create text: "Once upon..."
14
13
  p = Delayed::PerformableMethod.new(story, :tell)
15
- p.class.should == Delayed::PerformableMethod
16
- p.object.should == story
17
- p.method.should == :tell
18
- p.args.should == []
19
- p.perform.should == 'Once upon...'
14
+ expect(p.class).to eq(Delayed::PerformableMethod)
15
+ expect(p.object).to eq(story)
16
+ expect(p.method).to eq(:tell)
17
+ expect(p.args).to eq([])
18
+ expect(p.perform).to eq("Once upon...")
20
19
  end
21
20
 
22
- it "should allow class methods to be called on ActiveRecord models" do
23
- Story.create!(:text => 'Once upon a...')
21
+ it "allows class methods to be called on ActiveRecord models" do
22
+ Story.create!(text: "Once upon a...")
24
23
  p = Delayed::PerformableMethod.new(Story, :count)
25
- lambda { expect(p.send(:perform)).to eql 1 }.should_not raise_error
24
+ expect { expect(p.send(:perform)).to be 1 }.not_to raise_error
26
25
  end
27
26
 
28
- it "should allow class methods to be called" do
27
+ it "allows class methods to be called" do
29
28
  p = Delayed::PerformableMethod.new(StoryReader, :reverse, args: ["ohai"])
30
- lambda { p.send(:perform).should == "iaho" }.should_not raise_error
29
+ expect { expect(p.send(:perform)).to eq("iaho") }.not_to raise_error
31
30
  end
32
31
 
33
- it "should allow module methods to be called" do
32
+ it "allows module methods to be called" do
34
33
  p = Delayed::PerformableMethod.new(MyReverser, :reverse, args: ["ohai"])
35
- lambda { p.send(:perform).should == "iaho" }.should_not raise_error
34
+ expect { expect(p.send(:perform)).to eq("iaho") }.not_to raise_error
36
35
  end
37
36
 
38
- it "should store arguments as native YAML if they are active record objects" do
39
- story = Story.create :text => 'Once upon...'
37
+ it "stores arguments as native YAML if they are active record objects" do
38
+ story = Story.create text: "Once upon..."
40
39
  reader = StoryReader.new
41
40
  p = Delayed::PerformableMethod.new(reader, :read, args: [story])
42
- p.class.should == Delayed::PerformableMethod
43
- p.method.should == :read
44
- p.args.should == [story]
45
- p.perform.should == 'Epilog: Once upon...'
41
+ expect(p.class).to eq(Delayed::PerformableMethod)
42
+ expect(p.method).to eq(:read)
43
+ expect(p.args).to eq([story])
44
+ expect(p.perform).to eq("Epilog: Once upon...")
46
45
  end
47
46
 
48
- it "should deeply de-AR-ize arguments in full name" do
49
- story = Story.create :text => 'Once upon...'
47
+ it "deeplies de-AR-ize arguments in full name" do
48
+ story = Story.create text: "Once upon..."
50
49
  reader = StoryReader.new
51
- p = Delayed::PerformableMethod.new(reader, :read, args: [['arg1', story, { [:key, 1] => story }]])
52
- p.full_name.should == "StoryReader#read([\"arg1\", Story.find(#{story.id}), {[:key, 1] => Story.find(#{story.id})}])"
50
+ p = Delayed::PerformableMethod.new(reader, :read, args: [["arg1", story, { [:key, 1] => story }]])
51
+ expect(p.full_name).to eq(
52
+ "StoryReader#read([\"arg1\", Story.find(#{story.id}), {[:key, 1] => Story.find(#{story.id})}])"
53
+ )
53
54
  end
54
55
 
55
- it "should call the on_failure callback" do
56
- story = Story.create :text => 'wat'
56
+ it "calls the on_failure callback" do
57
+ story = Story.create text: "wat"
57
58
  p = Delayed::PerformableMethod.new(story, :tell, on_failure: :text=)
58
- p.send(:on_failure, 'fail')
59
- story.text.should == 'fail'
59
+ p.send(:on_failure, "fail")
60
+ expect(story.text).to eq("fail")
60
61
  end
61
62
 
62
- it "should call the on_permanent_failure callback" do
63
- story = Story.create :text => 'wat'
63
+ it "calls the on_permanent_failure callback" do
64
+ story = Story.create text: "wat"
64
65
  p = Delayed::PerformableMethod.new(story, :tell, on_permanent_failure: :text=)
65
- p.send(:on_permanent_failure, 'fail_frd')
66
- story.text.should == 'fail_frd'
66
+ p.send(:on_permanent_failure, "fail_frd")
67
+ expect(story.text).to eq("fail_frd")
67
68
  end
68
69
 
69
70
  it "can still generate a name with no kwargs" do
70
- story = Story.create :text => 'wat'
71
+ story = Story.create text: "wat"
71
72
  p = Delayed::PerformableMethod.new(story, :tell, kwargs: nil)
72
73
  expect(p.full_name).to eq("Story.find(#{story.id}).tell()")
73
74
  end