Sidekiq, deliver_later and its parameters

409 views
Skip to first unread message

Sabri

unread,
Dec 11, 2019, 11:04:52 AM12/11/19
to Sidekiq
Hi,

I'm trying to debug an error that occurs randomly when using deliver_later.

From the sidekiq wiki I learnt that I can't use complex object as a parameters Workers but I don't understand if the same applies for Mailers.
Let's say I have a ActiveRecord model called Order; can these lines cause an error?

order = Order.last

OrderMailer.with(order: order).paid.deliver_later

The mailer is working properly but sometimes I get a MissingTemplate error (with the same code and the template exists) and I'm checking possible sources of error.


Rails 5.2.3
Sidekiq 5.2.7

Mike Perham

unread,
Dec 11, 2019, 11:28:25 AM12/11/19
to sid...@googlegroups.com
deliver_later is an ActiveJob API and has nothing to do with Sidekiq. You should read the ActiveJob guide.


--
You received this message because you are subscribed to the Google Groups "Sidekiq" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sidekiq+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sidekiq/2fa23ed2-ffbb-422f-b883-2f3d2f8cf1eb%40googlegroups.com.


--
Mike Perham – CEO, Contributed Systems
Smart, effective open source infrastructure for your apps.

Sabri

unread,
Dec 11, 2019, 11:44:46 AM12/11/19
to Sidekiq
Yes, I know that.
I've setup Sidekiq as queue_adapter so when I run deliver_later, Sidekiq will perform the delivery (maybe I'm wrong on this).
ActiveJob can get an object as a parameter meanwhile Sidekiq can't (or at least I should not pass AR objects).
For that reason I don't understand if passing an object when using deliver_later can cause issues.

BTW, thanks for Sidekiq!

On Wednesday, December 11, 2019 at 5:28:25 PM UTC+1, Mike Perham wrote:
deliver_later is an ActiveJob API and has nothing to do with Sidekiq. You should read the ActiveJob guide.


On Wed, Dec 11, 2019 at 8:04 AM Sabri <plusatt...@gmail.com> wrote:
Hi,

I'm trying to debug an error that occurs randomly when using deliver_later.

From the sidekiq wiki I learnt that I can't use complex object as a parameters Workers but I don't understand if the same applies for Mailers.
Let's say I have a ActiveRecord model called Order; can these lines cause an error?

order = Order.last

OrderMailer.with(order: order).paid.deliver_later

The mailer is working properly but sometimes I get a MissingTemplate error (with the same code and the template exists) and I'm checking possible sources of error.


Rails 5.2.3
Sidekiq 5.2.7

--
You received this message because you are subscribed to the Google Groups "Sidekiq" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sid...@googlegroups.com.

Mike Perham

unread,
Dec 11, 2019, 11:47:03 AM12/11/19
to sid...@googlegroups.com
As the AJ docs state, you can pass AR objects as parameters. deliver_later is no different.

To unsubscribe from this group and stop receiving emails from it, send an email to sidekiq+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sidekiq/3756aa3f-eb74-497e-a1f4-a670059ec15d%40googlegroups.com.

Sabri

unread,
Dec 11, 2019, 11:51:31 AM12/11/19
to Sidekiq
Ok. Thank you
Reply all
Reply to author
Forward
0 new messages