drush
drush copied to clipboard
Add a progress bar to the queue:run command
Just an idea for a small improvement I had: the queue:run command could use a progress bar, especially in case of large queues.
If the queue worker logs messages, are they still shown? If so, I think this LGTM
I just tested and it looks like Drupal logs are never logged to the console: not with the progress bar, not without.
One thing we might want to change - not sure though - is to only start a progress bar once the first queue item is processed. What do you think?
Thanks. I'm also curious about any drush log messages that come from the worker. Maybe thats too uncommon to care about.
The screenshot should also show the total number of items, right? Otherwise progress is a bit hard to understand. Once that is done, we could arguably get rid of the log message that reports progress.
Thanks. I'm also curious about any drush log messages that come from the worker. Maybe thats too uncommon to care about.
Here's what that looks like:
Multiple logs per queue item:
The screenshot should also show the total number of items, right?
It does, except when there's 0 items to be processed, which is why I proposed to not even start the progress bar at all in that case.
Thats super ugly IMO. Once a progress bar starts repeating lines it loses its value IMO. Happy to discuss more.
I agree, but I'm not sure if there's anything straightforward we can do about this. Also haven't tested this yet with Laravel Prompts https://laravel.com/docs/11.x/prompts#progress
On the other hand, progress bars are also used by the entity:delete and entity:save commands, the same thing could happen there as well. And what would be the alternative? How could we display both a progress bar and a list of messages? I just experimented a bit with console sections, but I can't seem to get it to work for our use case: https://symfony.com/blog/new-in-symfony-4-1-advanced-console-output
Right, there isnt. a great alternative. And thats why this command hasnt been made a progress bar for years. The other two commands you mention were converted by eager contributors, not me. I merged their PRs because others liked it. I actually dislike progress bars on CLI personally.