Skip to content

Commit

Permalink
Avoid ArgumentError when using kwargs with delay
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwr18 committed Dec 13, 2023
1 parent d3a6482 commit b84d258
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/jobs/broadcast_request_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
class BroadcastRequestJob < ApplicationJob
queue_as :broadcast_request

def perform(request_id:)
def perform(request_id)
request = Request.where(id: request_id).first
return unless request
return if request.broadcasted_at.present?

if request.planned? # rescheduled for future after this job was created
BroadcastRequestJob.delay(run_at: request.schedule_send_for).perform_later(request_id: request.id)
BroadcastRequestJob.delay(run_at: request.schedule_send_for).perform_later(request.id)
return
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def messages_by_contributor

def self.broadcast!(request)
if request.planned?
BroadcastRequestJob.delay(run_at: request.schedule_send_for).perform_later(request_id: request.id)
BroadcastRequestJob.delay(run_at: request.schedule_send_for).perform_later(request.id)
RequestScheduled.with(request_id: request.id).deliver_later(User.all)
else
Contributor.active.with_tags(request.tag_list).each do |contributor|
Expand Down

0 comments on commit b84d258

Please sign in to comment.