Skip to content

Allow setting the total number of items in the progress bar #38

Open
@mboynes

Description

@mboynes

Description

Provide the implementing developer a way to set the total number of items in the progress bar. As of now, it is set to the max id, which isn't necessarily the number of items being processed.

Use Case

In my use case, I'm only processing about a tenth of the database, so after I create the Bulk_Task object, I'm setting the cursor to the value (1 less than that which) I want to start at. When I start the command, the progress bar is 90% progressed, because my start ID is roughly 90% of the max id.

Implementation ideas:

  • We could fire an action at the end of before_run() (and after_run()), which would be enough to let a developer control the progress bar.
  • We could choose to only set the total if it hasn't already been set, giving developers the ability to set it themselves.
  • We would need to change how set_current is being called because it's passing in the post ID, which could be done with a callback to give developers a chance to modify this value (e.g., subtracting the start ID from the current).
  • Add an ability to set a min ID when the bulk task is created, and then it will use that value as a floor and report progress based on that floor (could also work with a cursor, where the cursor sets the floor, and progress is reported from the cursor position to the end).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestphpRequires understanding PHP

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions