From e94362d88e256f8db5482892c6651607ae6ba5bd Mon Sep 17 00:00:00 2001 From: scottshipman Date: Wed, 20 Mar 2019 12:14:16 -0400 Subject: [PATCH 1/4] [ENG-814] fix memory leaks when batch processing --- Model/Cache.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Model/Cache.php b/Model/Cache.php index 2cd362c7..485480e3 100644 --- a/Model/Cache.php +++ b/Model/Cache.php @@ -84,6 +84,7 @@ public function create() } if (count($entities)) { $this->getRepository()->saveEntities($entities); + $this->em->clear('MauticPlugin\MauticContactClientBundle\Entity\Cache'); } } @@ -150,6 +151,7 @@ private function getUtmSource() $utmHelper = $this->getContainer()->get('mautic.contactclient.helper.utmsource'); $this->utmSource = $utmHelper->getFirstUtmSource($this->contact); } + $this->getContainer()->get('doctrine.orm.entity_manager')->clear('Mautic\LeadBundle\Entity\UtmTag'); return $this->utmSource; } From 3183a77230c2ae4520298821f70df5db33cdbc1e Mon Sep 17 00:00:00 2001 From: scottshipman Date: Wed, 20 Mar 2019 12:20:06 -0400 Subject: [PATCH 2/4] [ENG-814] use em instead of getting container again --- Model/Cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/Cache.php b/Model/Cache.php index 485480e3..9e729c81 100644 --- a/Model/Cache.php +++ b/Model/Cache.php @@ -151,7 +151,7 @@ private function getUtmSource() $utmHelper = $this->getContainer()->get('mautic.contactclient.helper.utmsource'); $this->utmSource = $utmHelper->getFirstUtmSource($this->contact); } - $this->getContainer()->get('doctrine.orm.entity_manager')->clear('Mautic\LeadBundle\Entity\UtmTag'); + $this->em->clear('Mautic\LeadBundle\Entity\UtmTag'); return $this->utmSource; } From b9a04d91f69d24c0ef88740067a89439b21ba399 Mon Sep 17 00:00:00 2001 From: scottshipman Date: Wed, 20 Mar 2019 12:22:36 -0400 Subject: [PATCH 3/4] [ENG-814] move clear inside conditional --- Model/Cache.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Model/Cache.php b/Model/Cache.php index 9e729c81..b323fe7a 100644 --- a/Model/Cache.php +++ b/Model/Cache.php @@ -150,9 +150,8 @@ private function getUtmSource() if (!$this->utmSource) { $utmHelper = $this->getContainer()->get('mautic.contactclient.helper.utmsource'); $this->utmSource = $utmHelper->getFirstUtmSource($this->contact); + $this->em->clear('Mautic\LeadBundle\Entity\UtmTag'); } - $this->em->clear('Mautic\LeadBundle\Entity\UtmTag'); - return $this->utmSource; } From 76acbd8d8d7099c9c4fd85b746296561e76f46ad Mon Sep 17 00:00:00 2001 From: scottshipman Date: Mon, 25 Mar 2019 14:45:47 -0400 Subject: [PATCH 4/4] php cs fixer --- Model/Cache.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Model/Cache.php b/Model/Cache.php index b323fe7a..fdd2ac99 100644 --- a/Model/Cache.php +++ b/Model/Cache.php @@ -152,6 +152,7 @@ private function getUtmSource() $this->utmSource = $utmHelper->getFirstUtmSource($this->contact); $this->em->clear('Mautic\LeadBundle\Entity\UtmTag'); } + return $this->utmSource; }