acidic_job 1.0.0.beta.9 → 1.0.0.beta.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55e96056c881f1a048efc79156db98799bd911ac8417803260499ef1d9f69ff7
4
- data.tar.gz: 52ae51638b01352db67279455f08b086c2be8c725914fe32c84542d9b5927325
3
+ metadata.gz: 6c2f5b13489acc0e87c1de14248857c107d794a60d0af9a3cafdc5606c80929c
4
+ data.tar.gz: 6bc97dda18375d3efd1cd37c7c6c2642b2cbe6c44a73e3451e07ebcce738ab30
5
5
  SHA512:
6
- metadata.gz: 4b6a2f319942e8f5973255453608edab836b8e02c421ab3291725b171817f100061319b0fed5af60a706ae8b4eabc15f3b62f146eeff0a97474fa817547a53ff
7
- data.tar.gz: 6fa11549153a9334089a59534e049e59fba1a5f353069d49ec347238f3e6f26b18b0deb618414e99b33a33400554d05b0ebc29389c12ce1c0e5cb5c727ef90c1
6
+ metadata.gz: 586158e2ccfa061f7efa636dd14ef9d83be1105d32e964e29a77df6728e941d8506379794e7144b8ec41f8c4e7187fae6de66cf7c37c16fd07d45a6e84bdb849
7
+ data.tar.gz: fdf9c926a74abc99262c76a508f07dd87de823958b5ea3230a5c6f98c17cb2f93153a32f8d34cb4c27145f0a5838a5e2090a32f815b7e8c61a50f7aafa65b39e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- acidic_job (1.0.0.beta.9)
4
+ acidic_job (1.0.0.beta.10)
5
5
  activejob
6
6
  activerecord
7
7
  activesupport
@@ -10,11 +10,11 @@ module AcidicJob
10
10
  return if json.nil? || json.empty?
11
11
 
12
12
  data = JSON.parse(json)
13
- Arguments.deserialize(data).first
13
+ Arguments.send :deserialize_argument, data
14
14
  end
15
15
 
16
16
  def dump(obj)
17
- data = Arguments.serialize [obj]
17
+ data = Arguments.send :serialize_argument, obj
18
18
  data.to_json
19
19
  rescue ActiveJob::SerializationError
20
20
  raise UnserializableValue
@@ -6,24 +6,16 @@ module AcidicJob
6
6
  module Serializers
7
7
  class JobSerializer < ::ActiveJob::Serializers::ObjectSerializer
8
8
  def serialize(job)
9
- super(job.serialize)
9
+ # don't serialize the `enqueued_at` value, as ActiveRecord will check if the Run record has changed
10
+ # by comparing the deserialized database value with a temporary in-memory generated value.
11
+ # That temporary in-memory generated value can sometimes have an `enqueued_at` value that is 1 second off
12
+ # from the original. In this case, ActiveRecord will think the record has unsaved changes and block the lock.
13
+ super(job.as_json.merge("job_class" => job.class.name))
10
14
  end
11
15
 
12
16
  def deserialize(hash)
13
- job = ActiveJob::Base.deserialize(hash)
17
+ job = ::ActiveJob::Base.deserialize(hash)
14
18
  job.send(:deserialize_arguments_if_needed)
15
- # this is a shim to ensure we can work with Ruby 2.7 as well as 3.0+
16
- # :nocov:
17
- if job.arguments.last.is_a?(Hash)
18
- *args, kwargs = job.arguments
19
- else
20
- args = job.arguments
21
- kwargs = {}
22
- end
23
- # :nocov:
24
- job.instance_variable_set(:@__acidic_job_args, args)
25
- job.instance_variable_set(:@__acidic_job_kwargs, kwargs)
26
-
27
19
  job
28
20
  end
29
21
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AcidicJob
4
- VERSION = "1.0.0.beta.9"
4
+ VERSION = "1.0.0.beta.10"
5
5
  end
@@ -50,10 +50,6 @@ module AcidicJob
50
50
  wrapped_method = WorkflowStep.new(run: @run, job: @job).wrapped
51
51
  current_step = @run.current_step_name
52
52
 
53
- # can't reproduce yet, but saw a bug in production where
54
- # nested awaits workflows had an unsaved `workflow` attribute
55
- @run.save! if @run.has_changes_to_save?
56
-
57
53
  AcidicJob.logger.log_run_event("Executing #{current_step}...", @job, @run)
58
54
  @run.with_lock do
59
55
  @step_result = wrapped_method.call(@run)
@@ -64,10 +60,6 @@ module AcidicJob
64
60
  def run_step_result
65
61
  next_step = @run.next_step_name
66
62
 
67
- # can't reproduce yet, but saw a bug in production where
68
- # nested awaits workflows had an unsaved `workflow` attribute
69
- @run.save! if @run.has_changes_to_save?
70
-
71
63
  AcidicJob.logger.log_run_event("Progressing to #{next_step}...", @job, @run)
72
64
  @run.with_lock do
73
65
  @step_result.call(run: @run)
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: 1.0.0.beta.9
4
+ version: 1.0.0.beta.10
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 00:00:00.000000000 Z
11
+ date: 2022-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob