Skip to content
Snippets Groups Projects
Commit db5e7aee authored by catch's avatar catch
Browse files

Issue #3520750 by alexpott: Use a transaction PoDatabaseWriter to improve performance

(cherry picked from commit c15eed32)
parent 362cab42
Branches
Tags
8 merge requests!12661Issue #3255804 by godotislate, longwave, berdir, alexpott, catch, andypost,...,!12660Issue #3255804 by godotislate, longwave, berdir, alexpott, catch, andypost,...,!12618Issue #3522970 by longwave, smustgrave: Remove unused BrowserTestBase::$originalContainer,!12473Issue #3521639 by mstrelan, smustgrave for 11.2,!12462Issue #3523109 by ghost of drupal past, donquixote, nicxvan, dww, larowlan,...,!12357Issue #3529639 by mradcliffe, smustgrave, solomon.yifru: replacing a depricated css,!8811Issue #3129179: Provide some way to rebuild the persistent bundle field map,!7916Remove taxonomy dependency on node module - 11.x
Pipeline #508959 passed with warnings
Pipeline: drupal

#508978

    Pipeline: drupal

    #508976

      Pipeline: drupal

      #508974

        +4
        ...@@ -198,10 +198,15 @@ public function writeItem(PoItem $item) { ...@@ -198,10 +198,15 @@ public function writeItem(PoItem $item) {
        * {@inheritdoc} * {@inheritdoc}
        */ */
        public function writeItems(PoReaderInterface $reader, $count = -1) { public function writeItems(PoReaderInterface $reader, $count = -1) {
        // Processing multiple writes in a transaction is quicker than committing
        // each individual write.
        $transaction = \Drupal::database()->startTransaction();
        $forever = $count == -1; $forever = $count == -1;
        while (($count-- > 0 || $forever) && ($item = $reader->readItem())) { while (($count-- > 0 || $forever) && ($item = $reader->readItem())) {
        $this->writeItem($item); $this->writeItem($item);
        } }
        // Commit the transaction.
        unset($transaction);
        } }
        /** /**
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment