Skip to content
Open
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
14 changes: 5 additions & 9 deletions app/models/solid_queue/job/executable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,11 @@ def dispatch_all_one_by_one(jobs)
end

def successfully_dispatched(jobs)
dispatched_and_ready(jobs) + dispatched_and_blocked(jobs)
end

def dispatched_and_ready(jobs)
where(id: ReadyExecution.where(job_id: jobs.map(&:id)).pluck(:job_id))
end

def dispatched_and_blocked(jobs)
where(id: BlockedExecution.where(job_id: jobs.map(&:id)).pluck(:job_id))
job_ids = jobs.map(&:id)
dispatched_ids = ReadyExecution.where(job_id: job_ids).pluck(:job_id) +
BlockedExecution.where(job_id: job_ids).pluck(:job_id)
dispatched_ids = dispatched_ids.to_set
jobs.select { |job| dispatched_ids.include?(job.id) }
end
end

Expand Down
3 changes: 2 additions & 1 deletion app/models/solid_queue/job/schedulable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def schedule_all_at_once(jobs)
end

def successfully_scheduled(jobs)
where(id: ScheduledExecution.where(job_id: jobs.map(&:id)).pluck(:job_id))
scheduled_ids = ScheduledExecution.where(job_id: jobs.map(&:id)).pluck(:job_id).to_set
jobs.select { |job| scheduled_ids.include?(job.id) }
end
end

Expand Down
Loading