nerdgeschoss / shimmer

Shimmer is a collection of Rails extensions that bring advanced UI features into your app and make your life easier as a developer.
https://nerdgeschoss.de
MIT License
5 stars 1 forks source link

Document Rules on how to write a Sidekiq Job #72

Open jmarsh24 opened 1 year ago

jmarsh24 commented 1 year ago

a few ideas

jmarsh24 commented 1 year ago

https://github.com/toptal/active-job-style-guide

I found this article which seems pretty in-depth on how to use active_job.

@nerdgeschoss/nerdgeschoss maybe we can all read through this and voice our opinions on what we think should be highlights and also rules that we follow on our internal projects?

Adeynack commented 1 year ago
  • always set explicit retry settings

That was required by @JensRavens on a meeting some weeks ago. This goes in 👍🏼

  • always set a priority
  • figure out which queues we need and what their priorities are

This is more like always set an explicit queue, which will determine its priority.

  • create mixins for unique jobs (e.g. availability update) and rate-limited jobs (e.g. jobs calling external apis)

Rate limiting raisable errors should exist in the class where the API is being called. The job can however then set specific retry strategies based on specific errors being raised. See discart_on and retry_on). We have to see how well those work with Sidekiq, since they are ActiveJob concepts. There are however ways of also doing this directly with Sidekiq.