Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize searchkick reindex queue per model #1634

Open
beetlegius opened this issue May 3, 2023 · 1 comment
Open

Customize searchkick reindex queue per model #1634

beetlegius opened this issue May 3, 2023 · 1 comment

Comments

@beetlegius
Copy link

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.

@lawnchamp
Copy link

I have also added this monkey patch. I agree this would be a nice feature to add

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants