Call for Contributions: Move DelayedJob Calls to ActiveJob

ben

Ben Halpern

Posted on September 13, 2019

Call for Contributions: Move DelayedJob Calls to ActiveJob

Hey folks, we've been working on a gradual migration from DelayedJob to ActiveJob within the DEV codebase.

Move delay calls to ActiveJob #3136

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 job perform_later call
  • you may need to modify the existing tests by using perform_enqueued_job instead of run_background_jobs_immediately helper

Remember to pass record ids (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

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
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