activejob-status 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/activejob-status/status.rb +9 -3
- data/lib/activejob-status/version.rb +1 -1
- data/lib/activejob-status.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93c7fee3b739316143dadbbc360b14c1557c30e6a83199d606675d4eb5164f7b
|
4
|
+
data.tar.gz: eef77191de849b3f4a063569a0b9016c55fb1c94b3c1856d8ed89e69bedb9631
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bf621c0950c2c55e03d8aca6ffd38e327d0ae4afd5a55d130af80c02e4d81a5dc4557133dd7dd4ee394113ba3e3ebfc831feb268aee2fdc7caef9d2fde6d9b6
|
7
|
+
data.tar.gz: d0a5aac3bf768f3c17f396dc09c6386364bea3291862ca6144df032c5d7aacdae0a351347e86ff480dde17d322ad9353e19f64664280a9d27d7503d3aa5e2918
|
@@ -23,8 +23,10 @@ module ActiveJob
|
|
23
23
|
alias_method :to_h, :read
|
24
24
|
|
25
25
|
def update(payload, options = {})
|
26
|
-
@job.
|
27
|
-
|
26
|
+
if @job.respond_to?(:progress)
|
27
|
+
@job.progress.instance_variable_set(:@progress, payload[:progress]) if payload.include?(:progress)
|
28
|
+
@job.progress.instance_variable_set(:@total, payload[:total]) if payload.include?(:total)
|
29
|
+
end
|
28
30
|
|
29
31
|
@storage.update(@job, payload, **options)
|
30
32
|
end
|
@@ -56,6 +58,8 @@ module ActiveJob
|
|
56
58
|
# Update default data
|
57
59
|
|
58
60
|
def update_defaults(status_key)
|
61
|
+
raise "cannot call #update_defaults when status is accessed from outside the job" if @job.is_a?(String)
|
62
|
+
|
59
63
|
payload = {}
|
60
64
|
payload[:status] = status_key if @defaults.include?(:status)
|
61
65
|
payload[:serialized_job] = @job.serialize if @defaults.include?(:serialized_job)
|
@@ -63,10 +67,12 @@ module ActiveJob
|
|
63
67
|
end
|
64
68
|
|
65
69
|
def catch_exception(e)
|
70
|
+
raise "cannot call #catch_exception when status is accessed from outside the job" if @job.is_a?(String)
|
71
|
+
|
66
72
|
payload = {}
|
67
73
|
payload[:status] = :failed if @defaults.include?(:status)
|
68
74
|
payload[:serialized_job] = @job.serialize if @defaults.include?(:serialized_job)
|
69
|
-
payload[:exception] = {class: e.class.name, message: e.
|
75
|
+
payload[:exception] = {class: e.class.name, message: e.original_message} if @defaults.include?(:exception)
|
70
76
|
update(payload, force: true)
|
71
77
|
end
|
72
78
|
end
|
data/lib/activejob-status.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activejob-status
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Savater Sebastien
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|