-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
If Elastic Search is down, No alive nodes error is still thrown even if using Laravel queues #93
Comments
Hey @chrisgrim, were you able to resolve the issue? From the call stack you shared, I can conclude that Laravel decided that queues are not configured:
if (! config('scout.queue')) {
return $models->first()->searchableUsing()->delete($models);
} Have you reset the config cache after enabling the queues? |
I ran php artisan config:cache and cleared the cache.
and just to be safe I updated my config.scout file
I event tried editing the Searchable.php file itself on line 83 and still I am getting the same error
Is there a better way to test this? |
Hi @chrisgrim, I tried locally, and it seems to be working for me. Can you try to check what config you have inside |
Hi @babenkoivan
So I think I am doing something wrong. However, if I SSH into my server and open the searchable.php file in my vendor folder I get
|
Hey @chrisgrim, thanks for the hint. Apparently, some of your models become unsearchable when saved due to: if (! $model->shouldBeSearchable()) {
if ($model->wasSearchableBeforeUpdate()) {
$model->unsearchable();
}
return;
}
public function queueRemoveFromSearch($models)
{
if ($models->isEmpty()) {
return;
}
if (! config('scout.queue')) {
return $models->first()->searchableUsing()->delete($models);
}
dispatch(new Scout::$removeFromSearchJob($models))
->onQueue($models->first()->syncWithSearchUsingQueue())
->onConnection($models->first()->syncWithSearchUsing());
} I suggest you update Scout at least to 9.1. Hope this helps! |
@babenkoivan |
When I would save a model that was searchable and elastic search was down it would throw an error and cause issues for the user. I was recommended to use laravel queues to fix this issue. I set it up and have been using it for my project and everything works great using the queues. However as soon as I turn off elastic search to test it out I get the error below. I looked at the jobs database and I see that it hasn't even had a chance to save the job, its is erroring out before hand. If I turn elastic search back on I can see the jobs are submitted to the jobs database.
Does this mean that something else is erroring out before scout can send the job to the queue.
Here is an example job payload when elastic search is on to show that queues are working.
{"uuid":"9b4d91c7-ea0c-451b-9fb2-17f130b49d43","displayName":"Laravel\\Scout\\Jobs\\MakeSearchable","job":"Illuminate\\Queue\\CallQueuedHandler@call","maxTries":null,"maxExceptions":null,"backoff":null,"timeout":null,"retryUntil":null,"data":{"commandName":"Laravel\\Scout\\Jobs\\MakeSearchable","command":"O:33:\"Laravel\\Scout\\Jobs\\MakeSearchable\":10:{s:6:\"models\";O:45:\"Illuminate\\Contracts\\Database\\ModelIdentifier\":4:{s:5:\"class\";s:16:\"App\\Models\\Event\";s:2:\"id\";a:1:{i:0;i:1113;}s:9:\"relations\";a:5:{i:0;s:9:\"favorites\";i:1;s:11:\"priceranges\";i:2;s:5:\"shows\";i:3;s:10:\"age_limits\";i:4;s:9:\"organizer\";}s:10:\"connection\";s:5:\"mysql\";}s:10:\"connection\";s:8:\"database\";s:5:\"queue\";N;s:15:\"chainConnection\";N;s:10:\"chainQueue\";N;s:19:\"chainCatchCallbacks\";N;s:5:\"delay\";N;s:11:\"afterCommit\";N;s:10:\"middleware\";a:0:{}s:7:\"chained\";a:0:{}}"}}
The text was updated successfully, but these errors were encountered: