Reputation: 299
I have defined a rake task and a worker job using sidekiq as below. The rake task is not calling the worker job. Please help me find my problem.
Office.rake
namespace :office do
desc "send reminder emails"
task send_reminder: :environment do
Office.all.each do |office|
(office.issues.includes(:billings).where("issues.api_accounts_receivable > 0").select { |issue| (issue.billings.last.date < Message.last.date) if issue.billings.present? }).each do |issue|
puts "Issue ID is #{issue["id"]}"
ReminderWorker.perform_async("#{issue["id"]}")
end
end
end
end
reminder_worker.rb
class ReminderWorker
include Sidekiq::Worker
def perform(issue_id)
puts issue_id
end
end
puts don't show output for issue_id in the terminal for the worker but does show output for "Issue ID is #{issue["id"]}" mentioned in the rake task when I call the rake office:send_reminder from the terminal.
Upvotes: 0
Views: 600