Skip to content

Delayed extensions

mperham edited this page Apr 17, 2012 · 52 revisions

Sidekiq includes a similar feature to DelayedJob which allows you to make ActiveRecord method calls and ActionMailer deliveries asynchronous.

The delayed extensions might only work on Ruby 1.9.3 and JRuby 1.7+. Issue #84 claims that it will work with YAML::ENGINE.yamler = 'psych'. YMMV.

ActionMailer

Use delay to deliver your emails asynchronously.

UserMailer.delay.welcome_email(@user)

You can also easily extend the devise gem to send emails using sidekiq.

ActiveRecord

Use delay to asynchronously execute arbitrary methods on your ActiveRecord instance or classes.

User.delay.delete_old_users('some', 'params')
@user.delay.update_orders(1, 2, 3)

Clone this wiki locally