What's the difference between perform_async, perform_in, and perform_at?

Beginner

Answer

These methods control when jobs are executed:

# Execute immediately (as soon as worker is available)
MyWorker.perform_async(arg1, arg2)

# Execute after a delay
MyWorker.perform_in(5.minutes, arg1, arg2)

# Execute at specific time
MyWorker.perform_at(DateTime.tomorrow.noon, arg1, arg2)

Scheduled jobs are stored in a separate Redis sorted set and moved to queues when their time arrives.