I'm queuing a command (via another command) that, if handled by queue:work takes ~1 minute to execute, but if run via artisan horizon, takes only ~15 seconds. I've validated and the code gets properly executed - this queued command loads data from a file into the DB, and I've confirmed the data is loaded correctly in both cases.
$ php artisan integ:load ctlem
Job for files C_afi1411T.txt e C_afi1411V.txt created.
$ php artisan queue:work --queue=data_load --tries=3 --timeout=0
[2019-11-20 09:49:18][1] Processing: Illuminate\Foundation\Console\QueuedCommand
[2019-11-20 09:50:16][1] Processed: Illuminate\Foundation\Console\QueuedCommand
^C
$ php artisan integ:load ctlem
Job for files C_afi1411T.txt e C_afi1411V.txt created.
$ php artisan horizon
Horizon started successfully.
[2019-11-20 09:51:10][2] Processing: Illuminate\Foundation\Console\QueuedCommand
[2019-11-20 09:51:25][2] Processed: Illuminate\Foundation\Console\QueuedCommand
^CShutting down...
$
I've also logged the time before and after the call to the "heavy" function inside the queue command itself, and the log confirms the time, i.e., it is not related to any setup and teardown activity..
Happy to provide more details if required. Any ideas why this difference ?
Ok, so I've identified the cause of this difference: XDebug. Although I was not actively debugging, disabling xdebug in php.ini speeds up 'artisan queue:work' significantly.
While this is obviously expected, the fact that running 'artisan horizon' somehow bypasses xdebug and 'artisan quque:work' does not, was new to me.
Anyway, maybe this helps future developers...