acidic_job 1.0.0.rc6 → 1.0.0.rc7
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/README.md +1 -1
- data/lib/acidic_job/engine.rb +14 -8
- data/lib/acidic_job/serializers/exception_serializer.rb +4 -0
- data/lib/acidic_job/serializers/job_serializer.rb +4 -0
- data/lib/acidic_job/serializers/new_record_serializer.rb +4 -0
- data/lib/acidic_job/serializers/range_serializer.rb +5 -5
- data/lib/acidic_job/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6583544dc3b3545721d81facda79a461cb8a3a7a8078d2dc309dbc887c0dc1a7
|
|
4
|
+
data.tar.gz: 89f94171898b64372b85b6dcca3c4f6134e608f39c4aadeb8a776ce7c1a6e294
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 25fb20afe5782e1e73f23c2c020948ba732f25e9abb9cf32dcc5803eb74fa7f3c3bb4e674aaf6bd80263d235251fc043b5ee23f2176cdb0b2e99397c1e74ef7a
|
|
7
|
+
data.tar.gz: a09e720a54df383804b54d63b1acf8bd6b2bc912e05dea373f2912b87bbaa5f4e7e60413491ae13e4c780ba99e5cc842e73774837a08dbc87d8e223502534a70
|
data/README.md
CHANGED
|
@@ -183,7 +183,7 @@ class Job < ActiveJob::Base
|
|
|
183
183
|
```
|
|
184
184
|
|
|
185
185
|
> [!TIP]
|
|
186
|
-
> You should think carefully about what constitutes a unique execution of a workflow. Imagine you had a workflow job for balance
|
|
186
|
+
> You should think carefully about what constitutes a unique execution of a workflow. Imagine you had a workflow job for balance transfers. Jill transfers $10 to John. Your system **must** be able to differentiate between retries of this transfer and new independent transfers. If you were only to use the `sender`, `recipient`, and `amount` as your `unique_by` values, then if Jill tries to transfer another $10 to John at some point in the future, that work will be considered a retry of the first transfer and not a new transfer.
|
|
187
187
|
|
|
188
188
|
|
|
189
189
|
### Orchestrating steps
|
data/lib/acidic_job/engine.rb
CHANGED
|
@@ -26,14 +26,20 @@ module AcidicJob
|
|
|
26
26
|
require_relative "serializers/exception_serializer"
|
|
27
27
|
require_relative "serializers/new_record_serializer"
|
|
28
28
|
require_relative "serializers/job_serializer"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Serializers::
|
|
33
|
-
Serializers::
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
|
|
30
|
+
serializers = [
|
|
31
|
+
Serializers::ExceptionSerializer.instance,
|
|
32
|
+
Serializers::NewRecordSerializer.instance,
|
|
33
|
+
Serializers::JobSerializer.instance
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
# Rails 7.1+ includes a RangeSerializer, so only add ours for older versions
|
|
37
|
+
unless defined?(ActiveJob::Serializers::RangeSerializer)
|
|
38
|
+
require_relative "serializers/range_serializer"
|
|
39
|
+
serializers << Serializers::RangeSerializer.instance
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
ActiveJob::Serializers.add_serializers(*serializers)
|
|
37
43
|
end
|
|
38
44
|
end
|
|
39
45
|
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
require "active_job/serializers/object_serializer"
|
|
4
4
|
|
|
5
|
-
# :nocov:
|
|
6
5
|
module AcidicJob
|
|
7
6
|
module Serializers
|
|
7
|
+
# This serializer is only used for Rails versions prior to 7.1,
|
|
8
|
+
# which introduced ActiveJob::Serializers::RangeSerializer.
|
|
8
9
|
class RangeSerializer < ::ActiveJob::Serializers::ObjectSerializer
|
|
9
10
|
KEYS = %w[begin end exclude_end].freeze
|
|
10
11
|
|
|
11
12
|
def serialize(range)
|
|
12
|
-
args = Arguments.serialize([
|
|
13
|
+
args = ::ActiveJob::Arguments.serialize([range.begin, range.end, range.exclude_end?])
|
|
13
14
|
super(KEYS.zip(args).to_h)
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
def deserialize(hash)
|
|
17
|
-
klass.new(
|
|
18
|
+
klass.new(*::ActiveJob::Arguments.deserialize(hash.values_at(*KEYS)))
|
|
18
19
|
end
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
def klass
|
|
21
22
|
::Range
|
|
22
23
|
end
|
|
23
24
|
end
|
|
24
25
|
end
|
|
25
26
|
end
|
|
26
|
-
# :nocov:
|
data/lib/acidic_job/version.rb
CHANGED