Skip to content

Customize searchkick reindex queue per model #1634

@beetlegius-jt

Description

@beetlegius-jt

First
Search existing issues to see if it’s been discussed. ✅

Is your feature request related to a problem? Please describe.
When there are multiple models that should be indexed, sometimes some of them are more critical than others. Having all the model reindexing jobs in the same generic queue (searchkick) makes them equals, when they're not. Sometimes we want to have some classes to get reindexed as soon as possible when others can have less priority.

Describe the solution you'd like
Adding queue_name as a model option could be enough. The current implementation does support the queue_name option globally at the Searchkick class level only.

class Person
  searchkick queue_name: :low_priority
end

class Document
  searchkick queue_name: :critical
end

Additional context
The workaround I found is by monkey patching the job:

class Searchkick::ReindexV2Job
  queue_as { "searchkick_#{arguments.first.tableize}" }
end

but would be ideal to replace this with something provided by the gem itself.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions