What is the difference between perfrom_async and delay in Sidekiq?

actionmailer, asynchronous, background-process, sidekiq

Solution

perform_async is Sidekiq's native API. delay is a compatibility API with DelayedJob. Use perform_async when possible.

Problem

When reading the Sidekiq Wiki I see the following examples: From Getting started: Send a message to be processed asynchronously: ``` HardWorker.perform_async('bob', 5) ``` You can also send messages by calling the delay method on a class method: ``` User.delay.do_some_stuff(current_user.id, 20) ``` Also, from Delayed extensions: Use delay to deliver your emails asynchronously. Use delay_for(interval) or delay_until(time) to deliver the email at some point in the future. UserMailer.delay.welcome_email(@user.id) UserMailer.delay_for(5.days).find_more_friends_email(@user.id) UserMailer.delay_until(5.days.from_now).find_more_friends_email(@user.id) So what is actually the difference between `perfrom_async` and `delay`? In which situations would I prefer the one over the other?

Original source