tw: wrap map ops in transaction
parent
eb51b59152
commit
fe0de6e9cb
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue