-
Notifications
You must be signed in to change notification settings - Fork 51
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
Disabled meilisearch-rails but it still triggers the configured background jobs #399
Comments
From reading the source code, I'm not sure this is unintended behavior. The |
I realized later that, in fact, Meilisearch was disabled in my application, but since I didn't restart Sidekiq, it was still active. As the application added items to the queue, Sidekiq attempted to communicate with the Meilisearch server, causing connection errors. However, your PR already helps a lot in my case, as it prevents the items from unnecessarily consuming sidekiq's processing. Finally, all of this made me reflect that it might be even better and cleaner to disable, in the first place, the callbacks added by meilisearch-rails, if disabled. Please check: ellnix#1 |
I can imagine that could be really inefficient, especially if sidekiq is configured to retry on failure (though I'm not sure sidekiq would realize that the indexing is failing even)
I'll paste my review of the change in that PR for anyone going through this discussion in the future. The PR makes a change to only create callbacks on models when meilisearch is active.
|
Thank you for the review! I hadn't thought about that case. In my specific situation, it doesn't make sense to toggle Meilisearch on and off at runtime, so disabling the callbacks when it's inactive is actually useful. However, I understand that in a scenario where this configuration changes dynamically, the approach would need to be different. |
Have you quantified it in some way? The inactive callbacks are not that computationally expensive, so I'm having a hard time seeing why that would be the case. If there's a benefit to disabling callbacks we could have a separate config field for disabling callbacks. |
I haven't measured it, but I just prefer to avoid dead ends. I know it's not the original purpose, but I’d rather treat the active flag more strictly—preventing meilisearch-rails from interfering with the execution flow. |
Description
When I disable Meilisearch using the active parameter:
It is not completely disabled. It still triggers the background jobs if the enqueue option is set:
meilisearch enqueue: :trigger_sidekiq_job
Expected behavior
It should not trigger the background job.
Current behavior
It triggers the background job.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: