Is it possible to set scout queue to false when running scout import?

Hi,

A brief context of my use case - my application uses Scout Extended Laravel package and it has options for me to set env SCOUT_QUEUE=true which it will send the index action to the queue and the queue is currently setup with AWS SQS t2.medium.

When I tried to run php artisan scout:import on CI tool (Jenkins in this case), it behaves as expected that it will send the actions to the queue. The only issue I noticed is that my AWS SQS instance was having a hard time processing the job as I believe the index job is a little intensive to run and thus the instance became unresponsive.

Long story short, I am wondering when I run php artisan scout:import, is it possible for me to tell if I want it to run on the spot and not pushing the job to the queue like passing a flag --queue=false since my CI server is more capable of running intensive jobs and thus without having us to use a larger SQS instance for this use case?

Thanks!
Oi

I believe you can override the env variable when calling the command:

SCOUT_QUEUE=false php artisan scout:import

Another solution would be to see the queue to “sync” in your CI, so Laravel process jobs immediately.

Let me know if it’s what you’re looking for.

Hi, thanks for the reply!

I don’t think I can simply call SCOUT_QUEUE=false directly in the bash environment to override Laravel’s env variable at runtime and I tried adding it to CI before calling the command and that was the case.

I know I can set the queue config in the code by calling something like config('queue.default, 'sync'), but don’t think I can set it at runtime in the bash command.

I’m not familiar with our scout integration, but looking at the doc, apparently the queue behavior of Scout is controlled in config/scout.php:

'queue' => true,

https://laravel.com/docs/7.x/scout#queueing

I see no reason why this couldn’t be overridden by an env variable.
For instance, most CI environments set the CI environment variable.

'queue' => $_ENV['CI'] ? false : true,

@Jerska Thanks! Will try this approach to see if it works.

In case anyone found this useful, turns out in CI bash script, I can simply do:

export SCOUT_QUEUE=false
php artisan scout:import

Setting the server variable first before calling the command indeed solves this use case here. The server variable is taking precedent before checking the env file key.

Thanks!