Hi I have used async task to send emails and sms from my ruby server in the past.
This is not working
def notify_customer_create
SendEmailWorker.perform_async('EstimationMailer', 'new_estimation', self.id)
end
This is working
def notify_customer_create
EstimationMailer.new_estimation(self.id).deliver
end
So i got around it. But now i am facing problem to send sms the same way.
Here is the code i have:
def send_on_create_confirmation_instructions
unless self.guest
phone_number = self.mobile_phone.number
self.update_attribute(:confirmation_sent_at, Time.now)
SendSecretCodeWorker.perform_async(phone_number, self.confirmation_token)
end
end
Here is the definition:
class SendSecretCodeWorker
include Sidekiq::Worker
sidekiq_options retry: false
def perform(number, code)
MobileOperator.send_code(number, code)
end
end
Somehow perform_async doesnt work. How to send it without using "async" as i did for emails?
Aucun commentaire:
Enregistrer un commentaire