From a86d8b441a866e8d385e58930945f2dc474b5ddd Mon Sep 17 00:00:00 2001 From: Bethany Seeger Date: Thu, 14 Oct 2021 15:52:36 -0400 Subject: [PATCH] Fixes a bug where the timer was not started soon enough. --- src/MigrateBatchExecutable.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/MigrateBatchExecutable.php b/src/MigrateBatchExecutable.php index 2f82639..de268a2 100644 --- a/src/MigrateBatchExecutable.php +++ b/src/MigrateBatchExecutable.php @@ -279,6 +279,11 @@ public function processBatch(&$context) { try { $context['finished'] = $sandbox['current'] / $sandbox['total']; + // call hasTime() once at the begining to start the timer and set the timer threshold. + // If we don't then it won't get called until after the first record is processed and the + // algorithm won't consider the time it spent on the first record. Large file ingests + // will hit a php max exec timeout then. + static::hasTime(); while ($context['finished'] < 1) { $item = $this->queue->claimItem(); if (!$item) {