/** * Execute the job. * * @return void */ public function handle(InventoryRepositoryInterface $inventoryRepository, InventorySummaryRepositoryInterface $inventorySummaryRepository, JobExperienceInterface $jobExperience) { $jobExperience->setClass($this); Log::debug(' attempts: ' . $this->attempts()); // First count the number of UPCs that have Inventory $itemCount = $inventoryRepository->countUPCs(); Log::debug(' Inventory Items count: ' . $itemCount); $jobExperience->setNumberOfRecordsProcessed($itemCount); // divide by 2000 to get number of invocations required $invocations = intval($itemCount / 2000 * 1.6) + 1; Log::debug(' invocations: ' . $invocations); $sleepSeconds = 1; // run the invocations for ($i = 0; $i < $invocations; $i++) { sleep($sleepSeconds); Log::debug(' run: ' . $i); //$sleepSeconds = 5; $inventorySummaryRepository->fireStoredProcedure(); } $jobExperience->ended(); }