canvas-jobs 0.10.3 → 0.10.4
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/lib/delayed/backend/active_record.rb +1 -1
- data/lib/delayed/version.rb +1 -1
- data/spec/active_record_job_spec.rb +28 -22
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea184ada62d200cf570338a65865761d2b168569
|
4
|
+
data.tar.gz: d11e965301438b83d7616bb76b98d42f4f6a5474
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 376142657bad6c98367b711f03b7c9a269eb1b00545933ba367875c85e5e745ea46bf9ec5c37e17760f4fbb5758c80584b931b384fb3ff6e11bd3d2830de59b0
|
7
|
+
data.tar.gz: c56ed66abde1f4fe3dac5320d5c4e6406cfed5f20b62c465b8406ec1599ec312433af2341c1a60574d17573411eb03ef537c651bca10a029a0e2de7816a5a91f
|
@@ -167,7 +167,7 @@ module Delayed
|
|
167
167
|
scope = scope.where(locked_by: ON_HOLD_LOCKED_BY)
|
168
168
|
scope.update_all(["locked_by = NULL, locked_at = NULL, attempts = 0, run_at = (CASE WHEN run_at > ? THEN run_at ELSE ? END), failed_at = NULL", now, now])
|
169
169
|
when 'destroy'
|
170
|
-
scope = scope.where("locked_by IS NULL OR locked_by=?", ON_HOLD_LOCKED_BY)
|
170
|
+
scope = scope.where("locked_by IS NULL OR locked_by=?", ON_HOLD_LOCKED_BY) unless opts[:flavor] == 'failed'
|
171
171
|
scope.delete_all
|
172
172
|
end
|
173
173
|
end
|
data/lib/delayed/version.rb
CHANGED
@@ -69,34 +69,40 @@ describe 'Delayed::Backed::ActiveRecord::Job' do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
describe "bulk_update failed jobs" do
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
5.times { @affected_jobs << create_job.tap { |j| j.fail! } }
|
78
|
-
@ignored_jobs << create_job(:run_at => 2.hours.from_now)
|
79
|
-
@ignored_jobs << create_job(:queue => 'q2')
|
72
|
+
context "holding/unholding failed jobs" do
|
73
|
+
before :each do
|
74
|
+
@job = Delayed::Job.create :payload_object => SimpleJob.new
|
75
|
+
Delayed::Job.get_and_lock_next_available('worker1').should == @job
|
76
|
+
@job.fail!
|
80
77
|
end
|
81
|
-
end
|
82
78
|
|
83
|
-
|
84
|
-
|
85
|
-
|
79
|
+
it "should raise error when holding failed jobs" do
|
80
|
+
expect { Delayed::Job.bulk_update('hold', :flavor => 'failed', :query => @query) }.to raise_error
|
81
|
+
end
|
86
82
|
|
87
|
-
|
88
|
-
|
83
|
+
it "should raise error unholding failed jobs" do
|
84
|
+
expect { Delayed::Job.bulk_update('unhold', :flavor => 'failed', :query => @query) }.to raise_error
|
85
|
+
end
|
89
86
|
end
|
90
87
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
88
|
+
context "deleting failed jobs" do
|
89
|
+
before :each do
|
90
|
+
2.times {
|
91
|
+
j = Delayed::Job.create(:payload_object => SimpleJob.new)
|
92
|
+
j.send(:lock_exclusively!, 'worker1').should == true
|
93
|
+
j.fail!
|
94
|
+
}
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should delete failed jobs by id" do
|
98
|
+
target_ids = Delayed::Job::Failed.all[0..2].map { |j| j.id }
|
99
|
+
Delayed::Job.bulk_update('destroy', :ids => target_ids, :flavor => 'failed', :query => @query).should == target_ids.length
|
100
|
+
end
|
95
101
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
102
|
+
it "should delete all failed jobs" do
|
103
|
+
failed_count = Delayed::Job::Failed.count
|
104
|
+
Delayed::Job.bulk_update('destroy', :flavor => 'failed', :query => @query).should == failed_count
|
105
|
+
end
|
100
106
|
end
|
101
107
|
end
|
102
108
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canvas-jobs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Luetke
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-01-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: after_transaction_commit
|
@@ -355,7 +355,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
355
355
|
version: '0'
|
356
356
|
requirements: []
|
357
357
|
rubyforge_project:
|
358
|
-
rubygems_version: 2.
|
358
|
+
rubygems_version: 2.5.1
|
359
359
|
signing_key:
|
360
360
|
specification_version: 4
|
361
361
|
summary: Instructure-maintained fork of delayed_job
|