imTigger / laravel-job-status

Add ability to track Job progress, status and result dispatched to Queue.
MIT License
407 stars 60 forks source link

Too many queries #73

Open armen9494 opened 2 years ago

armen9494 commented 2 years ago

Thank you for a very useful package, but it has one issue - it's sending too many queries. Every time you want to make an update, it's making one more query to get an object from database. Below is a code example and the result

public function index()
{
    $this->prepareStatus();

    $max = 20;
    $this->setProgressMax($max);

    for ($i = 0; $i <= $max; $i += 1) {
        $this->setProgressNow($i);
    }

    $this->setOutput(['total' => $max, 'other' => 'parameter']);
}
image