engagementDataBackfiller = $engagementDataBackfiller; } public function processTaskStrategy(ScheduledTaskEntity $task, $timer) { $meta = $task->getMeta(); $lastSubscriberId = $meta['last_subscriber_id'] ?? 0; do { $this->cronHelper->enforceExecutionLimit($timer); $batch = $this->engagementDataBackfiller->getBatch($lastSubscriberId, self::BATCH_SIZE); if (empty($batch)) { break; } $this->engagementDataBackfiller->updateBatch($batch); $lastSubscriberId = $this->engagementDataBackfiller->getLastProcessedSubscriberId(); $meta['last_subscriber_id'] = $lastSubscriberId; $task->setMeta($meta); $this->scheduledTasksRepository->persist($task); $this->scheduledTasksRepository->flush(); } while (count($batch) === self::BATCH_SIZE); return true; } }