-
Do not use delayed jobs if your system can have 100k+ jobs at a time in delayed jobs table. It'll cause the jobs to run very slow.
-
Check conditions before adding the jobs to queue, instead of checking inside the job. This'll prevent delayed jobs table from being over-populated.
# bad class Order < ApplicationRecord after_create :send_to_webhook def send_to_webhook if condition? # code end end handle_asynchronously :send_to_webhook end # good class Order < ApplicationRecord after_create :send_to_webhook, if: :condition? def send_to_webhook # code end handle_asynchronously :send_to_webhook end
Last active
April 21, 2022 10:20
-
-
Save ayerdines/1a25695f42a55b9e62ce40765abe1304 to your computer and use it in GitHub Desktop.
Read before using delayed jobs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment