Unverified Commit d2f42dad authored by Alex Pott's avatar Alex Pott
Browse files

perf: #3588385 Add a transaction around the database key value store setMultiple()

By: catch
By: mondrake
parent f6103006
Loading
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -159,6 +159,20 @@ public function set($key, $value) {
    }
  }

  /**
   * {@inheritdoc}
   */
  public function setMultiple(array $data): void {
    $transaction = $this->connection->startTransaction();
    try {
      parent::setMultiple($data);
      $transaction->commitOrRelease();
    }
    catch (\Exception) {
      $transaction->rollback();
    }
  }

  /**
   * Saves a value for a given key if it does not exist yet.
   *