Skip to content

Request: Specify a custom Searchkick::BulkReindexJob job class during reindex #1601

@jeffblake

Description

@jeffblake

It would be great if we could pass an argument to the relation indexer reindex to specify a custom job class instead of the default Searchkick::BulkReindexJob.

Use case:

We could have a few subclasses of Searchkick::BulkReindexJob and easily change some options such as the queue_as queue. For example I have a rake task to reindex all models, but with millions of rows I've decided to set up a separate Sidekiq process that only pulls jobs from a specific queue, to better control load and performance on the overall app. This works fine, but if I also need to use the relation reindex method in normal code operations, then I can't change the queue and it means I have to have that extra process always spun up (and paying for - I'm on Heroku).

Right now I have this in my initializer:

class Searchkick::BulkReindexJob
  include DatabaseFollower

  queue_as :searchkick_bulk

  #retry_on Sidekiq::Limiter::OverLimit, wait: ->(executions) { 10.seconds + rand(45) }, attempts: :unlimited

  around_perform :use_follower

end

With this feature I could have separate classes and change the queue, etc.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions