Submitting many ActionMail jobs at once with Sidekiq

Wander Hillen
Tue, 24 Aug 2021 00:00:00 UT

The default integration of ActiveJob with Sidekiq can be slow when submitting many jobs in a loop, because a new network roundtrip is made for every job. While Sidekiq does allow for multiple jobs to be submitted in the same call, this functionality is not natively available from Rails. This post describes the root cause of the problem and shows how to work around it with the `push_bulk` method provided by Sidekiq.