acidic_job 0.8.0 → 0.8.1
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/Gemfile.lock +1 -1
- data/README.md +17 -17
- data/lib/acidic_job/mixin.rb +6 -2
- data/lib/acidic_job/version.rb +1 -1
- 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: '0924564388ca928e9923161a95788dfb393e71f48d82ab6474e221793befc6af'
|
|
4
|
+
data.tar.gz: 0a06d0e7f933a9e0e319bc698a3ab216502033b9c9df46fa7646cd77bdb1109c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: db1b579a5887707c41534d825d261a024a25cab2c5619af1179d41360af85e8271bf16dc9fb29442aa1442f9d49366dbec60a8d8d3ea010eb15d4a413238fe40
|
|
7
|
+
data.tar.gz: 1c371720712b4eb34aec5c8b2aba077906100cc0b69bd72624844260c01522dfa4c5d843fea21b08efdc199dedfd08e8966c602b12bd73e04c8615c4e00f7487
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -153,9 +153,9 @@ class RideCreateJob < AcidicJob::Base
|
|
|
153
153
|
@params = ride_params
|
|
154
154
|
|
|
155
155
|
with_acidic_workflow persisting: { ride: nil } do |workflow|
|
|
156
|
-
step :create_ride_and_audit_record, awaits: awaits: [SomeJob.with('argument_1', keyword: 'value'), AnotherJob.with(1, 2, 3, some: 'thing')]
|
|
157
|
-
step :create_stripe_charge
|
|
158
|
-
step :send_receipt
|
|
156
|
+
workflow.step :create_ride_and_audit_record, awaits: awaits: [SomeJob.with('argument_1', keyword: 'value'), AnotherJob.with(1, 2, 3, some: 'thing')]
|
|
157
|
+
workflow.step :create_stripe_charge
|
|
158
|
+
workflow.step :send_receipt
|
|
159
159
|
end
|
|
160
160
|
end
|
|
161
161
|
end
|
|
@@ -172,9 +172,9 @@ class RideCreateJob < AcidicJob::Base
|
|
|
172
172
|
@params = ride_params
|
|
173
173
|
|
|
174
174
|
with_acidic_workflow persisting: { ride: nil } do |workflow|
|
|
175
|
-
step :create_ride_and_audit_record, awaits: :dynamic_awaits
|
|
176
|
-
step :create_stripe_charge
|
|
177
|
-
step :send_receipt
|
|
175
|
+
workflow.step :create_ride_and_audit_record, awaits: :dynamic_awaits
|
|
176
|
+
workflow.step :create_stripe_charge
|
|
177
|
+
workflow.step :send_receipt
|
|
178
178
|
end
|
|
179
179
|
end
|
|
180
180
|
|
|
@@ -228,9 +228,9 @@ class RideCreateJob < AcidicJob::Base
|
|
|
228
228
|
@params = ride_params
|
|
229
229
|
|
|
230
230
|
with_acidic_workflow persisting: { ride: nil } do |workflow|
|
|
231
|
-
step :create_ride_and_audit_record
|
|
232
|
-
step :create_stripe_charge
|
|
233
|
-
step :send_receipt
|
|
231
|
+
workflow.step :create_ride_and_audit_record
|
|
232
|
+
workflow.step :create_stripe_charge
|
|
233
|
+
workflow.step :send_receipt
|
|
234
234
|
end
|
|
235
235
|
end
|
|
236
236
|
|
|
@@ -264,9 +264,9 @@ class RideCreateJob < AcidicJob::Base
|
|
|
264
264
|
@params = ride_params
|
|
265
265
|
|
|
266
266
|
with_acidic_workflow persisting: { ride: nil } do |workflow|
|
|
267
|
-
step :create_ride_and_audit_record
|
|
268
|
-
step :create_stripe_charge
|
|
269
|
-
step :send_receipt
|
|
267
|
+
workflow.step :create_ride_and_audit_record
|
|
268
|
+
workflow.step :create_stripe_charge
|
|
269
|
+
workflow.step :send_receipt
|
|
270
270
|
end
|
|
271
271
|
end
|
|
272
272
|
|
|
@@ -294,11 +294,11 @@ class ExampleJob < AcidicJob::Base
|
|
|
294
294
|
end
|
|
295
295
|
```
|
|
296
296
|
|
|
297
|
-
Conversely, a job class can use the `
|
|
297
|
+
Conversely, a job class can use the `acidic_by_job_arguments` method to configure that job class to use the arguments passed to the job as the foundation for the job run's idempotency key:
|
|
298
298
|
|
|
299
299
|
```ruby
|
|
300
300
|
class ExampleJob < AcidicJob::Base
|
|
301
|
-
|
|
301
|
+
acidic_by_job_arguments
|
|
302
302
|
|
|
303
303
|
def perform(arg_1, arg_2)
|
|
304
304
|
# the idempotency key will be based on whatever the values of `arg_1` and `arg_2` are
|
|
@@ -348,9 +348,9 @@ class RideCreateJob < AcidicJob::Base
|
|
|
348
348
|
@params = ride_params
|
|
349
349
|
|
|
350
350
|
with_acidic_workflow persisting: { ride: nil } do |workflow|
|
|
351
|
-
step :create_ride_and_audit_record, awaits: [SomeJob.with('argument_1', keyword: 'value')]
|
|
352
|
-
step :create_stripe_charge, args: [1, 2, 3], kwargs: { some: 'thing' }
|
|
353
|
-
step :send_receipt
|
|
351
|
+
workflow.step :create_ride_and_audit_record, awaits: [SomeJob.with('argument_1', keyword: 'value')]
|
|
352
|
+
workflow.step :create_stripe_charge, args: [1, 2, 3], kwargs: { some: 'thing' }
|
|
353
|
+
workflow.step :send_receipt
|
|
354
354
|
end
|
|
355
355
|
end
|
|
356
356
|
|
data/lib/acidic_job/mixin.rb
CHANGED
|
@@ -43,8 +43,12 @@ module AcidicJob
|
|
|
43
43
|
# `perform_now` runs a job synchronously and immediately
|
|
44
44
|
# `perform_later` runs a job asynchronously and queues it immediately
|
|
45
45
|
# `perform_acidicly` run a job asynchronously and queues it after a successful database commit
|
|
46
|
-
def perform_acidicly(*args)
|
|
47
|
-
job =
|
|
46
|
+
def perform_acidicly(*args, **kwargs)
|
|
47
|
+
job = if kwargs.empty?
|
|
48
|
+
new(*args)
|
|
49
|
+
else
|
|
50
|
+
new(*args, **kwargs)
|
|
51
|
+
end
|
|
48
52
|
|
|
49
53
|
Run.stage!(job)
|
|
50
54
|
end
|
data/lib/acidic_job/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: acidic_job
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- fractaledmind
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-08-
|
|
11
|
+
date: 2022-08-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activejob
|