diff --git a/lib/Db/TimelineWriteMap.php b/lib/Db/TimelineWriteMap.php index 657d0aef..4233fd46 100644 --- a/lib/Db/TimelineWriteMap.php +++ b/lib/Db/TimelineWriteMap.php @@ -82,6 +82,8 @@ trait TimelineWriteMap return; } + $this->connection->beginTransaction(); + $query = $this->connection->getQueryBuilder(); $query->update('memories_mapclusters') ->set('point_count', $query->createFunction('point_count + 1')) @@ -92,6 +94,8 @@ trait TimelineWriteMap $query->executeStatement(); $this->mapUpdateAggregates($clusterId); + + $this->connection->commit(); } /** @@ -104,6 +108,8 @@ trait TimelineWriteMap */ private function mapCreateCluster(float $lat, float $lon): int { + $this->connection->beginTransaction(); + $query = $this->connection->getQueryBuilder(); $query->insert('memories_mapclusters') ->values([ @@ -117,6 +123,8 @@ trait TimelineWriteMap $clusterId = (int) $query->getLastInsertId(); $this->mapUpdateAggregates($clusterId); + $this->connection->commit(); + return $clusterId; } @@ -133,6 +141,8 @@ trait TimelineWriteMap return; } + $this->connection->beginTransaction(); + $query = $this->connection->getQueryBuilder(); $query->update('memories_mapclusters') ->set('point_count', $query->createFunction('point_count - 1')) @@ -143,6 +153,8 @@ trait TimelineWriteMap $query->executeStatement(); $this->mapUpdateAggregates($clusterId); + + $this->connection->commit(); } /**