From c9dda915dcd5b360b49bd485a9c68106f74f93a1 Mon Sep 17 00:00:00 2001 From: John Oleksowicz Date: Tue, 11 Jul 2023 16:18:47 -0500 Subject: [PATCH] Only create the backfill task once MAILPOET-5404 --- mailpoet/lib/Config/Populator.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mailpoet/lib/Config/Populator.php b/mailpoet/lib/Config/Populator.php index 4c2c8d29b2..4bfa2ce198 100644 --- a/mailpoet/lib/Config/Populator.php +++ b/mailpoet/lib/Config/Populator.php @@ -714,6 +714,14 @@ class Populator { } private function scheduleBackfillEngagementData(): void { + $existingTask = $this->scheduledTasksRepository->findOneBy( + [ + 'type' => BackfillEngagementData::TASK_TYPE, + ] + ); + if ($existingTask) { + return; + } $this->scheduleTask( BackfillEngagementData::TASK_TYPE, Carbon::createFromTimestamp($this->wp->currentTime('timestamp'))