Call for Contributions: Move DelayedJob Calls to ActiveJob
Ben Halpern
Posted on September 13, 2019
Hey folks, we've been working on a gradual migration from DelayedJob
to ActiveJob
within the DEV codebase.
Move delay calls to ActiveJob #3136
lightalloy
posted on
As described in #2497, to be less dependent of DelayedJob
we also need to move jobs which are created by calling delay
method to ActiveJob
:
Here is the list of the calls:
- [x]
Slackbot.ping
- [x]
reaction.create
- [x]
ArticleAnalyticsFetcher.new.update_analytics
- [x]
HtmlVariantSuccess.create
- [x]
HtmlVariantTrial.create
- [x]
message.send_push
- [x]
RssReader.new.fetch_user
- [x] several calls in
trigger_delayed_index
- [x]
index.delay.delete_object("users-#{id}")
- [x]
user.follow
- [x]
chat_channel.delay.index!
- https://github.com/thepracticaldev/dev.to/pull/4317
Actions for each of the calls:
- create a corresponding
ActiveJob
, specify a queue name - call the required method inside a job
- replace the
delay
method calls with a jobperform_later
call - you may need to modify the existing tests by using
perform_enqueued_job
instead ofrun_background_jobs_immediately
helper
Remember to pass record id
s (if needed) instead of ActiveRecord objects to a job to avoid deserialization errors (#1621)
Take a look at the issue. We have a lot of merged pull requests to use as a guideline to get you started, for example...
Moved send_mention_notification to ActiveJob #3566
lightalloy
posted on
What type of PR is this? (check all applicable)
- [x] Refactor
Description
- moved send_mention_notification to
ActiveJob
- used @copasetickid's pr and refined it
Related Tickets & Documents
#1996
Happy coding!
đ đȘ đ
đ©
Ben Halpern
Posted on September 13, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
opensource The Only Open-Source FAQ Guide You'll Ever NeedâStraight From the 0x3d Collection
November 20, 2024