Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nil awaits #44

Merged
merged 6 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 83 additions & 77 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,67 +9,67 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.3)
actionpack (= 7.0.3)
activesupport (= 7.0.3)
actioncable (7.0.3.1)
actionpack (= 7.0.3.1)
activesupport (= 7.0.3.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.3)
actionpack (= 7.0.3)
activejob (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
actionmailbox (7.0.3.1)
actionpack (= 7.0.3.1)
activejob (= 7.0.3.1)
activerecord (= 7.0.3.1)
activestorage (= 7.0.3.1)
activesupport (= 7.0.3.1)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.3)
actionpack (= 7.0.3)
actionview (= 7.0.3)
activejob (= 7.0.3)
activesupport (= 7.0.3)
actionmailer (7.0.3.1)
actionpack (= 7.0.3.1)
actionview (= 7.0.3.1)
activejob (= 7.0.3.1)
activesupport (= 7.0.3.1)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.3)
actionview (= 7.0.3)
activesupport (= 7.0.3)
actionpack (7.0.3.1)
actionview (= 7.0.3.1)
activesupport (= 7.0.3.1)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.3)
actionpack (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
actiontext (7.0.3.1)
actionpack (= 7.0.3.1)
activerecord (= 7.0.3.1)
activestorage (= 7.0.3.1)
activesupport (= 7.0.3.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.3)
activesupport (= 7.0.3)
actionview (7.0.3.1)
activesupport (= 7.0.3.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.3)
activesupport (= 7.0.3)
activejob (7.0.3.1)
activesupport (= 7.0.3.1)
globalid (>= 0.3.6)
activemodel (7.0.3)
activesupport (= 7.0.3)
activerecord (7.0.3)
activemodel (= 7.0.3)
activesupport (= 7.0.3)
activestorage (7.0.3)
actionpack (= 7.0.3)
activejob (= 7.0.3)
activerecord (= 7.0.3)
activesupport (= 7.0.3)
activemodel (7.0.3.1)
activesupport (= 7.0.3.1)
activerecord (7.0.3.1)
activemodel (= 7.0.3.1)
activesupport (= 7.0.3.1)
activestorage (7.0.3.1)
actionpack (= 7.0.3.1)
activejob (= 7.0.3.1)
activerecord (= 7.0.3.1)
activesupport (= 7.0.3.1)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.3)
activesupport (7.0.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -78,7 +78,7 @@ GEM
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.2)
builder (3.2.4)
combustion (1.3.5)
combustion (1.3.7)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
thor (>= 0.14.6)
Expand All @@ -102,16 +102,17 @@ GEM
rake
globalid (1.0.0)
activesupport (>= 5.0)
http (5.0.4)
http (5.1.0)
addressable (~> 2.8)
http-cookie (~> 1.0)
http-form_data (~> 2.2)
llhttp-ffi (~> 0.4.0)
http-cookie (1.0.4)
http-cookie (1.0.5)
domain_name (~> 0.5)
http-form_data (2.3.0)
i18n (1.10.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
json (2.6.2)
llhttp-ffi (0.4.0)
ffi-compiler (~> 1.0)
rake (~> 13.0)
Expand All @@ -124,7 +125,7 @@ GEM
method_source (1.0.0)
mini_mime (1.1.2)
mini_portile2 (2.8.0)
minitest (5.15.0)
minitest (5.16.2)
net-imap (0.2.3)
digest
net-protocol
Expand All @@ -140,70 +141,73 @@ GEM
net-protocol
timeout
nio4r (2.5.8)
nokogiri (1.13.6)
nokogiri (1.13.7)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.13.6-x86_64-darwin)
nokogiri (1.13.7-x86_64-darwin)
racc (~> 1.4)
noticed (1.5.9)
http (>= 4.0.0)
rails (>= 5.2.0)
parallel (1.22.1)
parser (3.1.2.0)
ast (~> 2.4.1)
psych (4.0.4)
stringio
public_suffix (4.0.7)
racc (1.6.0)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (7.0.3)
actioncable (= 7.0.3)
actionmailbox (= 7.0.3)
actionmailer (= 7.0.3)
actionpack (= 7.0.3)
actiontext (= 7.0.3)
actionview (= 7.0.3)
activejob (= 7.0.3)
activemodel (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
rack (2.2.4)
rack-test (2.0.2)
rack (>= 1.3)
rails (7.0.3.1)
actioncable (= 7.0.3.1)
actionmailbox (= 7.0.3.1)
actionmailer (= 7.0.3.1)
actionpack (= 7.0.3.1)
actiontext (= 7.0.3.1)
actionview (= 7.0.3.1)
activejob (= 7.0.3.1)
activemodel (= 7.0.3.1)
activerecord (= 7.0.3.1)
activestorage (= 7.0.3.1)
activesupport (= 7.0.3.1)
bundler (>= 1.15.0)
railties (= 7.0.3)
railties (= 7.0.3.1)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2)
rails-html-sanitizer (1.4.3)
loofah (~> 2.3)
railties (7.0.3)
actionpack (= 7.0.3)
activesupport (= 7.0.3)
railties (7.0.3.1)
actionpack (= 7.0.3.1)
activesupport (= 7.0.3.1)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
redis (4.6.0)
regexp_parser (2.4.0)
redis (4.7.1)
regexp_parser (2.5.0)
rexml (3.2.5)
rubocop (1.29.1)
rubocop (1.31.2)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.17.0, < 2.0)
rubocop-ast (>= 1.18.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.18.0)
rubocop-ast (1.19.1)
parser (>= 3.1.1.0)
rubocop-minitest (0.19.1)
rubocop-minitest (0.20.1)
rubocop (>= 0.90, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-progressbar (1.11.0)
sidekiq (6.4.2)
sidekiq (6.5.1)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
Expand All @@ -213,21 +217,22 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sqlite3 (1.4.2)
sqlite3 (1.4.4)
stringio (3.0.2)
strscan (3.0.3)
thor (1.2.1)
timeout (0.2.0)
timeout (0.3.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.1)
unicode-display_width (2.1.0)
warning (1.2.1)
unf_ext (0.0.8.2)
unicode-display_width (2.2.0)
warning (1.3.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.5.4)
zeitwerk (2.6.0)

PLATFORMS
ruby
Expand All @@ -240,6 +245,7 @@ DEPENDENCIES
minitest
net-smtp
noticed
psych (> 4.0)
railties
rake
rubocop
Expand Down
1 change: 1 addition & 0 deletions acidic_job.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "minitest"
spec.add_development_dependency "net-smtp"
spec.add_development_dependency "noticed"
spec.add_development_dependency "psych", "> 4.0"
spec.add_development_dependency "railties"
spec.add_development_dependency "rake"
spec.add_development_dependency "rubocop"
Expand Down
Empty file added combustion/log/test.log
Empty file.
2 changes: 1 addition & 1 deletion lib/acidic_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def process_run(run)
break
elsif current_step.nil?
raise UnknownRecoveryPoint, "Defined workflow does not reference this step: #{recovery_point}"
elsif !(jobs = current_step.fetch("awaits", []) || []).empty?
elsif !Array(jobs = current_step.fetch("awaits", []) || []).compact.empty?
step = Step.new(current_step, run, self)
# Only execute the current step, without yet progressing the recovery_point to the next step.
# This ensures that any failures in parallel jobs will have this step retried in the main workflow
Expand Down
2 changes: 1 addition & 1 deletion lib/acidic_job/awaiting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def enqueue_step_parallel_jobs(jobs_or_jobs_getter, run, step_result)
end

AcidicJob::Run.transaction do
awaited_jobs.each do |awaited_job|
awaited_jobs.compact.each do |awaited_job|
worker_class, args, kwargs = job_args_and_kwargs(awaited_job)

job = worker_class.new(*args, **kwargs)
Expand Down
6 changes: 6 additions & 0 deletions test/combustion/app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
include GlobalID::Identification
end
7 changes: 7 additions & 0 deletions test/combustion/app/models/audit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class Audit < ApplicationRecord
belongs_to :auditable, polymorphic: true
belongs_to :associated, polymorphic: true
belongs_to :user, polymorphic: true
end
5 changes: 5 additions & 0 deletions test/combustion/app/models/notification.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

class Notification < ApplicationRecord
include Noticed::Model
end
5 changes: 5 additions & 0 deletions test/combustion/app/models/ride.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

class Ride < ApplicationRecord
belongs_to :user
end
8 changes: 8 additions & 0 deletions test/combustion/app/models/user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

class User < ApplicationRecord
has_many :notifications, as: :recipient

validates :email, presence: true
validates :stripe_customer_id, presence: true
end
3 changes: 3 additions & 0 deletions test/combustion/config/database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test:
adapter: sqlite3
database: database.sqlite
Binary file added test/combustion/database.sqlite
Binary file not shown.
Loading