acidic_job 0.5.5 → 0.6.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/Gemfile.lock +1 -1
- data/lib/acidic_job/perform_transactionally_extension.rb +2 -2
- data/lib/acidic_job/version.rb +1 -1
- data/lib/acidic_job.rb +3 -3
- 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: 739d9a393b9dfcf91c6e941e188cab965a2800cf7a729e70a5d30542c76b1237
|
|
4
|
+
data.tar.gz: 6fb81e32e31e6db7001a11d607f33d3bc7f1cb5ddc147d48f8ead84ae15fc7d1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc2d1796950ffb4640d49dc61e05771b2a72f6b6776d96dda4fa35f93720e0687102e08bc8ad39a176d44be828528048df03c4492cbd0b1d121865ef929e5b8f
|
|
7
|
+
data.tar.gz: 32db6d94ca8a8a70d48a7afa863f85f50ebdf05320c9461b1f8c647d4681e697d7d5bc814864fb8846b516482db7057e8659598387f661e43764115f1525e840
|
data/Gemfile.lock
CHANGED
|
@@ -9,13 +9,13 @@ module AcidicJob
|
|
|
9
9
|
class_methods do
|
|
10
10
|
# rubocop:disable Metrics/MethodLength
|
|
11
11
|
def perform_transactionally(*args)
|
|
12
|
-
attributes = if self < ActiveJob::Base
|
|
12
|
+
attributes = if defined?(ActiveJob) && self < ActiveJob::Base
|
|
13
13
|
{
|
|
14
14
|
adapter: "activejob",
|
|
15
15
|
job_name: name,
|
|
16
16
|
job_args: job_or_instantiate(*args).serialize
|
|
17
17
|
}
|
|
18
|
-
elsif include?
|
|
18
|
+
elsif defined?(Sidekiq) && include?(Sidekiq::Worker)
|
|
19
19
|
{
|
|
20
20
|
adapter: "sidekiq",
|
|
21
21
|
job_name: name,
|
data/lib/acidic_job/version.rb
CHANGED
data/lib/acidic_job.rb
CHANGED
|
@@ -67,6 +67,7 @@ module AcidicJob
|
|
|
67
67
|
|
|
68
68
|
# set accessors for each argument passed in to ensure they are available
|
|
69
69
|
# to the step methods the job will have written
|
|
70
|
+
# THIS HAPPENS OUTSIDE OF ANY TRANSACTION
|
|
70
71
|
define_accessors_for_passed_arguments(with, @key)
|
|
71
72
|
|
|
72
73
|
# otherwise, we will enter a loop to process each required step of the job
|
|
@@ -141,7 +142,7 @@ module AcidicJob
|
|
|
141
142
|
ActiveRecord::Base.transaction(isolation: isolation_level) do
|
|
142
143
|
@key = Key.find_by(idempotency_key: key_val)
|
|
143
144
|
|
|
144
|
-
if @key
|
|
145
|
+
if @key.present?
|
|
145
146
|
# Programs enqueuing multiple jobs with different parameters but the
|
|
146
147
|
# same idempotency key is a bug.
|
|
147
148
|
raise MismatchedIdempotencyKeyAndJobArguments if @key.job_args != @arguments_for_perform
|
|
@@ -215,8 +216,7 @@ module AcidicJob
|
|
|
215
216
|
return job_id if defined?(job_id) && !job_id.nil?
|
|
216
217
|
return jid if defined?(jid) && !jid.nil?
|
|
217
218
|
|
|
218
|
-
|
|
219
|
-
SecureRandom.hex
|
|
219
|
+
Digest::SHA1.hexdigest [self.class.name, arguments_for_perform].flatten.join
|
|
220
220
|
end
|
|
221
221
|
end
|
|
222
222
|
# rubocop:enable Metrics/ModuleLength, Metrics/AbcSize, Metrics/MethodLength
|
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.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- fractaledmind
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-10-
|
|
11
|
+
date: 2021-10-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|