aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/ImportBundle')
-rw-r--r--src/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumer.php7
-rw-r--r--src/Wallabag/ImportBundle/Import/AbstractImport.php6
2 files changed, 11 insertions, 2 deletions
diff --git a/src/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumer.php b/src/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumer.php
index 8a8cf45d..72a3260a 100644
--- a/src/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumer.php
+++ b/src/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumer.php
@@ -7,6 +7,8 @@ use OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface;
7use PhpAmqpLib\Message\AMQPMessage; 7use PhpAmqpLib\Message\AMQPMessage;
8use Wallabag\ImportBundle\Import\AbstractImport; 8use Wallabag\ImportBundle\Import\AbstractImport;
9use Wallabag\UserBundle\Repository\UserRepository; 9use Wallabag\UserBundle\Repository\UserRepository;
10use Wallabag\CoreBundle\Entity\Entry;
11use Wallabag\CoreBundle\Entity\Tag;
10use Psr\Log\LoggerInterface; 12use Psr\Log\LoggerInterface;
11use Psr\Log\NullLogger; 13use Psr\Log\NullLogger;
12 14
@@ -53,7 +55,10 @@ class EntryConsumer implements ConsumerInterface
53 55
54 try { 56 try {
55 $this->em->flush(); 57 $this->em->flush();
56 $this->em->clear($entry); 58
59 // clear only affected entities
60 $this->em->clear(Entry::class);
61 $this->em->clear(Tag::class);
57 } catch (\Exception $e) { 62 } catch (\Exception $e) {
58 $this->logger->warning('Unable to save entry', ['entry' => $storedEntry, 'exception' => $e]); 63 $this->logger->warning('Unable to save entry', ['entry' => $storedEntry, 'exception' => $e]);
59 64
diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php
index 8610062d..39befa7b 100644
--- a/src/Wallabag/ImportBundle/Import/AbstractImport.php
+++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php
@@ -7,6 +7,7 @@ use Psr\Log\NullLogger;
7use Doctrine\ORM\EntityManager; 7use Doctrine\ORM\EntityManager;
8use Wallabag\CoreBundle\Helper\ContentProxy; 8use Wallabag\CoreBundle\Helper\ContentProxy;
9use Wallabag\CoreBundle\Entity\Entry; 9use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\CoreBundle\Entity\Tag;
10use Wallabag\UserBundle\Entity\User; 11use Wallabag\UserBundle\Entity\User;
11use OldSound\RabbitMqBundle\RabbitMq\Producer; 12use OldSound\RabbitMqBundle\RabbitMq\Producer;
12 13
@@ -113,7 +114,10 @@ abstract class AbstractImport implements ImportInterface
113 // flush every 20 entries 114 // flush every 20 entries
114 if (($i % 20) === 0) { 115 if (($i % 20) === 0) {
115 $this->em->flush(); 116 $this->em->flush();
116 $this->em->clear($entry); 117
118 // clear only affected entities
119 $this->em->clear(Entry::class);
120 $this->em->clear(Tag::class);
117 } 121 }
118 ++$i; 122 ++$i;
119 } 123 }