acidic_job 1.0.0.pre23 → 1.0.0.pre24

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: 5fb0d14a9e26e9a79f4976dc74318e97c096c695dacfed5a6546dff058ca4b1b
4
- data.tar.gz: abe13e27abaf05a1200a1bc245e649e00da1948847576df3ca1774101ca03d28
3
+ metadata.gz: 223aa8cad5d48e2a4fc04a9e33f82bdf7ef54cb933c2e14f3dc0aa6d46986932
4
+ data.tar.gz: a8a646da8f9e5987267f1448e44056bdd37c2d4f8cbfbc84650659555567b635
5
5
  SHA512:
6
- metadata.gz: 1f7abb59cb78202482f82e4c9057afabf3dc687b1c723d10c2b60e8bcea3a7bb6bd4c9c6b8d835f8498076f2a75fa124baba1571e4f16093d80c6fc0228c8658
7
- data.tar.gz: cea09574f0843c71b52c542eaeef20cd1ee330fd11a1f7c37977126d2c321ea3e055e8073b4c4ae525af17b133c3d98b50f1fa9d2ead2b93026b45897dc5945e
6
+ metadata.gz: 857647ff5cce856d41a8e30014005ef035cefcca383a719e6e679a4fc7bdc254c76f65e2d312c508ad56fd45b1e33ed533aecf2541e13b0480c579e0127ec338
7
+ data.tar.gz: 4208fa26057e5a1fb0908c554b8e2ef74c6a5018a4d782815caa1fbd7716f18b33598ff6877e3c0c583f449099438d316c506dee6fa84afea34d54aa42f085b8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- acidic_job (1.0.0.pre23)
4
+ acidic_job (1.0.0.pre24)
5
5
  activerecord
6
6
  activesupport
7
7
  database_cleaner
@@ -32,11 +32,10 @@ module AcidicJob
32
32
 
33
33
  return if run.finished?
34
34
 
35
- # job = job_class.constantize.deserialize(serialized_staged_job)
36
- # job.enqueue
37
-
38
35
  # when a batch of jobs for a step succeeds, we begin processing the `AcidicJob::Run` record again
39
- process_run(run)
36
+ # process_run(run)
37
+ run.update_column(:locked_at, nil)
38
+ job.enqueue
40
39
  end
41
40
 
42
41
  def enqueue_step_parallel_jobs(jobs_or_jobs_getter, run, step_result)
@@ -58,7 +58,7 @@ module AcidicJob
58
58
  ::Sidekiq::Client.push(
59
59
  "class" => self.class,
60
60
  "args" => @args,
61
- "jid" => @jid
61
+ "jid" => @acidic_job_run&.staged_job_id || @jid
62
62
  )
63
63
  end
64
64
  end
@@ -64,16 +64,19 @@ module AcidicJob
64
64
  error_object.present?
65
65
  end
66
66
 
67
- private
68
-
69
- def enqueue_staged_job
70
- return unless staged?
71
-
67
+ def staged_job_id
72
68
  # encode the identifier for this record in the job ID
73
69
  # base64 encoding for minimal security
74
70
  global_id = to_global_id.to_s.remove("gid://")
75
71
  encoded_global_id = Base64.encode64(global_id).strip
76
- staged_job_id = "STG__#{idempotency_key}__#{encoded_global_id}"
72
+
73
+ "STG__#{idempotency_key}__#{encoded_global_id}"
74
+ end
75
+
76
+ private
77
+
78
+ def enqueue_staged_job
79
+ return unless staged?
77
80
 
78
81
  serialized_staged_job = if serialized_job.key?("jid")
79
82
  serialized_job.merge("jid" => staged_job_id)
@@ -9,15 +9,6 @@ module AcidicJob
9
9
 
10
10
  private
11
11
 
12
- def delete_staged_job_record
13
- return unless was_staged_job?
14
-
15
- staged_job_run.delete
16
- true
17
- rescue ActiveRecord::RecordNotFound
18
- true
19
- end
20
-
21
12
  def was_staged_job?
22
13
  identifier.start_with? "STG__"
23
14
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AcidicJob
4
- VERSION = "1.0.0.pre23"
4
+ VERSION = "1.0.0.pre24"
5
5
  end
data/lib/acidic_job.rb CHANGED
@@ -50,13 +50,9 @@ module AcidicJob
50
50
  # TODO: write test for a staged job that uses awaits
51
51
  klass.set_callback :perform, :after, :reenqueue_awaited_by_job,
52
52
  if: -> { was_awaited_job? && !was_workflow_job? }
53
- klass.set_callback :perform, :after, :delete_staged_job_record,
54
- if: -> { was_staged_job? && !was_awaited_job? }
55
53
  klass.define_callbacks :finish
56
54
  klass.set_callback :finish, :after, :reenqueue_awaited_by_job,
57
55
  if: -> { was_workflow_job? && was_awaited_job? }
58
- klass.set_callback :finish, :after, :delete_staged_job_record,
59
- if: -> { was_workflow_job? && was_staged_job? && !was_awaited_job? }
60
56
 
61
57
  klass.instance_variable_set(:@acidic_identifier, :job_id)
62
58
  klass.define_singleton_method(:acidic_by_job_id) { @acidic_identifier = :job_id }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acidic_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre23
4
+ version: 1.0.0.pre24
5
5
  platform: ruby
6
6
  authors:
7
7
  - fractaledmind