laravel/scout

Scout::makeSearchableUsing is ignored with SCOUT_QUEUE=false

oprypkhantc opened this issue · 2 comments

Scout Version

10.2.4

Scout Driver

Algolia

Laravel Version

10.19.0

PHP Version

8.1.21

Database Driver & Version

No response

SDK Version

Other (ElasticSearch)

Meilisearch CLI Version

No response

Description

Hey.

Scout allows specifying a job that is used to sync models into a search driver through Scout::makeSearchableUsing(CustomMakeSearchable::class);. It works with SCOUT_QUEUE=true, but it's being completely ignored when using it with SCOUT_QUEUE=false.

Although it sort of makes sense, this bug makes it so that you can't customize the handle method of the said job in some environments where SCOUT_QUEUE=false is preferred, like on a CI.

Instead of straight up ignoring the job, Scout could instead simply dispatch it on sync queue (with dispatch_sync), which would both allow customizing the handle method of the job and run it in sync as expected:

Would this change be welcomed?

Steps To Reproduce

  1. Set SCOUT_QUEUE=false
  2. Write a custom job that extends Scout's MakeSearchable and overwrite handle method
  3. Specify it in a service provider: Scout::makeSearchableUsing(CustomMakeSearchable::class);

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

Closing this issue because it's inactive, already solved, old or not relevant anymore. Feel to open up a new issue if you're still experiencing this.