Имам приложение, в което мога да създам фактура, да я направя в pdf и да я изпратя на клиента. Имам две действия в пощата си:
class InvoiceMailer < ActionMailer::Base
default from: "[email protected]"
def send_invoice_reminder(invoice)
@invoice = invoice
attach_invoice
mail :subject => "Invoice reminder", :to => invoice.customer.email
end
def send_invoice(invoice)
@invoice = invoice
attach_invoice
mail :subject => "Your Invoice", :to => invoice.customer.email
end
protected
def attach_invoice
attachments["invoice.pdf"] = WickedPdf.new.pdf_from_string(
render_to_string(:pdf => "invoice",:template => 'admin/invoices/show.pdf.erb')
)
end
end
Сега искам да изпратя това чрез работниците на Sidkiq. Но имам въпрос. Дали имам нужда от двама sidekiq работници:
един за изпращане на имейл с фактура
второ за изпращане на напомняне
или може би един работник ще бъде достатъчен?