Inconsistent 'progress' datatype
Closed this issue · 2 comments
The first two code examples both use whole/integer number for progress representation:
$queuedJobsTable->updateProgress($id, ($i + 1) / $totalRecords);
$foo->doFirstPartOfTask();
$queuedJobsTable->updateProgress($jobId, 33);
But then the 3rd code block says $progress = $job->progress; // A float from 0 to 1
This is not true. If you use an integer in ->updateProgress()
, as the examples show, then ->progress
is also returned as an integer.
The only instance where I've found that ->progress
returns a "float" is when a job completes and the progress is updated inside QueuedJobsTable->markJobDone()
to progress = 1
.
Should the examples be updated to use floats to more accurately represent the end result? (ie: 0.33)
Feel free to fix up the docs
Ideally, I would imagine that the update method converts int to float, since that is a bit nicer to work with
We cannot change that now, so , yes, fixing docs is the best move
bced5aa
If there is anything else, feel free to directly PR it.