Disabling Composer's default timeout inside of scripts
•
1 min read
I like to use the scripts
key inside of my composer.json
to write reusable runner commands – normally things like background processes, build scripts, etc.
The problem is Composer has a default execution timeout of 30 seconds, so when I've got a long-running process like a queue worker running from a Composer script, it times out after 30 seconds.
Thankfully, there is a way to disable the timeout on a script-by-script basis.
{
"scripts": {
"queue": [
"Composer\\Config::disableProcessTimeout",
"php artisan queue:work"
]
}
}
All you need to do is turn the script into a multi-step one and add Composer\\Config::disableProcessTimeout
at start of the list. Composer's default 30 second timeout will be disabled for the rest of the steps.