delayed 0.4.0 → 0.5.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.
- checksums.yaml +4 -4
- data/lib/delayed/active_job_adapter.rb +4 -0
- data/spec/delayed/active_job_adapter_spec.rb +34 -0
- data/spec/performable_mailer_spec.rb +2 -2
- data/spec/worker_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a1cf38e09aa1495cf90b772f2ea4168497b2f1d819af54f1bf23644e591f021
|
4
|
+
data.tar.gz: 992f2c890116bb021368b4317d3d65aa37ac5c72627dc4d78e1815bb70b16fdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f24864e443ddf7f964be5bdf1f25fb1be789f8f19801b31a922fd4c18884bef412255c37676fa57813e96cca0a29299dfe620265ce6ff515351af70dd632ceb
|
7
|
+
data.tar.gz: ad160c352e49f6c5e75ddd1eea94bba65998bb291e8bb6a8c9815ec8387e1871f4acb7cd854abaaa450641598e70b05779e872ba0de8c992c3bf47401f5a1b9a
|
@@ -23,6 +23,40 @@ RSpec.describe Delayed::ActiveJobAdapter do
|
|
23
23
|
ActiveJob::Base.queue_adapter = adapter_was
|
24
24
|
end
|
25
25
|
|
26
|
+
it 'serializes a JobWrapper in the handler with expected fields' do
|
27
|
+
Timecop.freeze('2023-01-20T18:52:29Z') do
|
28
|
+
JobClass.perform_later
|
29
|
+
end
|
30
|
+
|
31
|
+
Delayed::Job.last.tap do |dj|
|
32
|
+
expect(dj.handler.lines).to match [
|
33
|
+
"--- !ruby/object:Delayed::JobWrapper\n",
|
34
|
+
"job_data:\n",
|
35
|
+
" job_class: JobClass\n",
|
36
|
+
/ job_id: '?#{dj.payload_object.job_id}'?\n/,
|
37
|
+
" provider_job_id: \n",
|
38
|
+
" queue_name: default\n",
|
39
|
+
" priority: \n",
|
40
|
+
" arguments: []\n",
|
41
|
+
" executions: 0\n",
|
42
|
+
(" exception_executions: {}\n" if ActiveJob::VERSION::MAJOR >= 6),
|
43
|
+
" locale: en\n",
|
44
|
+
(" timezone: \n" if ActiveJob::VERSION::MAJOR >= 6),
|
45
|
+
(" enqueued_at: '2023-01-20T18:52:29Z'\n" if ActiveJob::VERSION::MAJOR >= 6),
|
46
|
+
].compact
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'deserializes even if the underlying job class is not defined' do
|
51
|
+
JobClass.perform_later
|
52
|
+
|
53
|
+
Delayed::Job.last.tap do |dj|
|
54
|
+
dj.handler = dj.handler.gsub('JobClass', 'MissingJobClass')
|
55
|
+
expect { dj.payload_object }.not_to raise_error
|
56
|
+
expect { dj.payload_object.job_id }.to raise_error(NameError, 'uninitialized constant MissingJobClass')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
26
60
|
describe '.set' do
|
27
61
|
it 'supports priority as an integer' do
|
28
62
|
JobClass.set(priority: 43).perform_later
|
@@ -57,8 +57,8 @@ describe Delayed::PerformableMailer do
|
|
57
57
|
job = MyMailer.with(foo: 1, bar: 2).delay.signup('john@example.com', beta_tester: false)
|
58
58
|
expect(job.payload_object.class).to eq(Delayed::PerformableMailer)
|
59
59
|
expect(job.payload_object.object.class).to eq(described_class)
|
60
|
-
expect(job.payload_object.object.instance_variable_get(
|
61
|
-
expect(job.payload_object.object.instance_variable_get(
|
60
|
+
expect(job.payload_object.object.instance_variable_get(:@mailer)).to eq(MyMailer)
|
61
|
+
expect(job.payload_object.object.instance_variable_get(:@params)).to eq(foo: 1, bar: 2)
|
62
62
|
expect(job.payload_object.method_name).to eq(:signup)
|
63
63
|
expect(job.payload_object.args).to eq(['john@example.com'])
|
64
64
|
expect(job.payload_object.kwargs).to eq(beta_tester: false)
|
data/spec/worker_spec.rb
CHANGED
@@ -153,7 +153,7 @@ describe Delayed::Worker do
|
|
153
153
|
expect(Delayed::Job).to receive(:reserve).exactly(10).times.and_raise(Exception)
|
154
154
|
worker = described_class.new
|
155
155
|
9.times { worker.work_off }
|
156
|
-
expect
|
156
|
+
expect { worker.work_off }.to raise_exception Delayed::FatalBackendError
|
157
157
|
end
|
158
158
|
|
159
159
|
it 'allows the backend to attempt recovery from reservation errors' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delayed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Griffith
|
@@ -19,7 +19,7 @@ authors:
|
|
19
19
|
autorequire:
|
20
20
|
bindir: bin
|
21
21
|
cert_chain: []
|
22
|
-
date:
|
22
|
+
date: 2023-01-20 00:00:00.000000000 Z
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
name: activerecord
|
@@ -306,7 +306,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
306
306
|
- !ruby/object:Gem::Version
|
307
307
|
version: '0'
|
308
308
|
requirements: []
|
309
|
-
rubygems_version: 3.
|
309
|
+
rubygems_version: 3.3.5
|
310
310
|
signing_key:
|
311
311
|
specification_version: 4
|
312
312
|
summary: a multi-threaded, SQL-driven ActiveJob backend used at Betterment to process
|