Skip to content
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

Add a progress bar to the queue:run command #5986

Open
wants to merge 3 commits into
base: 12.x
Choose a base branch
from

Conversation

DieterHolvoet
Copy link
Contributor

Just an idea for a small improvement I had: the queue:run command could use a progress bar, especially in case of large queues.

@weitzman
Copy link
Member

weitzman commented May 6, 2024

If the queue worker logs messages, are they still shown? If so, I think this LGTM

@DieterHolvoet
Copy link
Contributor Author

I just tested and it looks like Drupal logs are never logged to the console: not with the progress bar, not without.

@DieterHolvoet
Copy link
Contributor Author

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?

CleanShot 2024-05-06 at 21 19 56@2x

@weitzman
Copy link
Member

weitzman commented May 6, 2024

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.

@DieterHolvoet
Copy link
Contributor Author

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:
CleanShot 2024-05-06 at 21 40 02@2x

Multiple logs per queue item:
CleanShot 2024-05-06 at 21 40 44@2x

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.

@weitzman
Copy link
Member

weitzman commented May 6, 2024

Thats super ugly IMO. Once a progress bar starts repeating lines it loses its value IMO. Happy to discuss more.

@DieterHolvoet
Copy link
Contributor Author

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

@DieterHolvoet
Copy link
Contributor Author

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

@weitzman
Copy link
Member

weitzman commented May 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants