acidic_job 1.0.0.pre24 → 1.0.0.pre25

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: 223aa8cad5d48e2a4fc04a9e33f82bdf7ef54cb933c2e14f3dc0aa6d46986932
4
- data.tar.gz: a8a646da8f9e5987267f1448e44056bdd37c2d4f8cbfbc84650659555567b635
3
+ metadata.gz: 305652928d6e3948110121767a94388b2f569a0ccc4693944cde5df2938c9a4b
4
+ data.tar.gz: 1c612e9380eaa0f73dd194441f69a988015e304c55c047793ad292f8c46e6c19
5
5
  SHA512:
6
- metadata.gz: 857647ff5cce856d41a8e30014005ef035cefcca383a719e6e679a4fc7bdc254c76f65e2d312c508ad56fd45b1e33ed533aecf2541e13b0480c579e0127ec338
7
- data.tar.gz: 4208fa26057e5a1fb0908c554b8e2ef74c6a5018a4d782815caa1fbd7716f18b33598ff6877e3c0c583f449099438d316c506dee6fa84afea34d54aa42f085b8
6
+ metadata.gz: f720cc6bebf8bdc4197295a3501b750e4b8b7741d7f04d6096aba426d45b37027d650664b038f1e45a32dc0763af9cd88ccec41c6d32dbdde56d0937a5af4df2
7
+ data.tar.gz: a7639fe45ebbea79331a8355a5f8a20fc95182341d575ca8a8040a0733cfe242f5e694ec98d1b442eea5235ccabf4280bd91f20f28ff1814b0bd32ffa95a8bff
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- acidic_job (1.0.0.pre24)
4
+ acidic_job (1.0.0.pre25)
5
5
  activerecord
6
6
  activesupport
7
7
  database_cleaner
@@ -17,6 +17,7 @@ module AcidicJob
17
17
  run = staged_job_run&.awaited_by || acidic_job_run&.awaited_by
18
18
 
19
19
  return unless run
20
+ return if run.batched_runs.outstanding.any?
20
21
 
21
22
  current_step = run.workflow[run.recovery_point.to_s]
22
23
  step_result = run.returning_to
@@ -31,7 +31,9 @@ module AcidicJob
31
31
  scope :staged, -> { where(staged: true) }
32
32
  scope :unstaged, -> { where(staged: false) }
33
33
  scope :finished, -> { where(recovery_point: FINISHED_RECOVERY_POINT) }
34
- scope :running, -> { where.not(recovery_point: FINISHED_RECOVERY_POINT) }
34
+ scope :outstanding, lambda {
35
+ where.not(recovery_point: FINISHED_RECOVERY_POINT).or(where(recovery_point: [nil, ""]))
36
+ }
35
37
 
36
38
  with_options unless: :staged? do
37
39
  validates :last_run_at, presence: true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AcidicJob
4
- VERSION = "1.0.0.pre24"
4
+ VERSION = "1.0.0.pre25"
5
5
  end
data/lib/acidic_job.rb CHANGED
@@ -50,6 +50,7 @@ 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, :finish_staged_job, if: -> { was_staged_job? && !was_workflow_job? }
53
54
  klass.define_callbacks :finish
54
55
  klass.set_callback :finish, :after, :reenqueue_awaited_by_job,
55
56
  if: -> { was_workflow_job? && was_awaited_job? }
@@ -136,6 +137,10 @@ module AcidicJob
136
137
 
137
138
  private
138
139
 
140
+ def finish_staged_job
141
+ FinishedPoint.new.call(run: staged_job_run)
142
+ end
143
+
139
144
  def was_workflow_job?
140
145
  defined?(@acidic_job_run) && @acidic_job_run.present?
141
146
  end
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.pre24
4
+ version: 1.0.0.pre25
5
5
  platform: ruby
6
6
  authors:
7
7
  - fractaledmind
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-26 00:00:00.000000000 Z
11
+ date: 2022-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord