-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
artisan queue:listen ignores changes in the .env file #28939
Comments
You should always use |
That's true when you're using the But when you use the So in this case, |
I think that would mean that you'd have to halt the queue:listen and just restart it to refresh the process environment? |
Yes, that's the problem. I think this is not the correct behaviour, when using the
|
@veencel I'm afraid I don't agree with that. Any long-running process will need to be restarted when changes to the environment have been made. That's the way it has always worked afaik. At the very least this seems more a feature request than a bug since the current behavior would be changed. So please open up an issue on the ideas repo to try to see how you'd change the internals in order to make this works. Thanks |
Description:
When running the
Illuminate\Queue\Console\ListenCommand
command, changes in the .env file are ignored if the config is not cached.The reason is that all environment variables are inherited by the
Illuminate\Queue\Console\WorkCommand
process, and when it loads the environment variables inIlluminate\Foundation\Bootstrap\LoadEnvironmentVariables
, it doesn't overload existing values.I'm using Laravel Forge, and when I start a worker using the UI and the
Run Worker As Daemon
option is unchecked, I have to restart thequeue:listen
command after changing something in the .env file.Solution:
PutEnvAdapter
as discussed here.queue:work
command instead of thequeue:listen
solves it, too. (queue can be restarted with thequeue:restart
command). On Forge, use theRun Worker As Daemon
option.This might not be an issue at all,
queue:listen
is not in the documentation, but when you create a worker on Forge with the default settings, it uses that command.I'm opening this because I couldn't find anything about it, maybe it helps someone.
Steps To Reproduce:
sync
ornull
.php artisan queue:listen
App\Jobs\Test::dispatch()
The text was updated successfully, but these errors were encountered: