Merge pull request #1942 from wallabag/optimize-import

Optimize import
This commit is contained in:
Thomas Citharel 2016-04-18 22:13:48 +02:00
commit ca8d61b958
4 changed files with 305 additions and 2 deletions

View file

@ -258,6 +258,7 @@ class PocketImport implements ImportInterface
// flush every 20 entries
if (($i % 20) === 0) {
$this->em->flush();
$this->em->clear($entry);
}
++$i;
}

View file

@ -185,6 +185,7 @@ abstract class WallabagImport implements ImportInterface
// flush every 20 entries
if (($i % 20) === 0) {
$this->em->flush();
$this->em->clear($entry);
}
++$i;
}

View file

@ -58,7 +58,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$entryRepo->expects($this->exactly(3))
$entryRepo->expects($this->exactly(24))
->method('findByUrlAndUserId')
->will($this->onConsecutiveCalls(false, true, false));
@ -75,7 +75,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
$res = $wallabagV2Import->import();
$this->assertTrue($res);
$this->assertEquals(['skipped' => 1, 'imported' => 2], $wallabagV2Import->getSummary());
$this->assertEquals(['skipped' => 22, 'imported' => 2], $wallabagV2Import->getSummary());
}
public function testImportAndMarkAllAsRead()

File diff suppressed because one or more lines are too long