Skip to content

Commit

Permalink
Merge pull request #529 from utopia-php/fix-order-deletes
Browse files Browse the repository at this point in the history
Move updates cache clear out of transaciton
  • Loading branch information
abnegate authored Feb 17, 2025
2 parents 1e42d2f + 197fda8 commit e59e6e0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Database/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -4166,18 +4166,18 @@ public function updateDocuments(string $collection, Document $updates, array $qu
$lastDocument = end($affectedDocuments);
}

foreach ($documents as $document) {
$this->purgeCachedDocument($collection->getId(), $document->getId());
}

$this->trigger(self::EVENT_DOCUMENTS_UPDATE, new Document([
'$collection' => $collection->getId(),
'modified' => count($documents)
]));

return $documents;
});

foreach ($documents as $document) {
$this->purgeCachedDocument($collection->getId(), $document->getId());
}

$this->trigger(self::EVENT_DOCUMENTS_UPDATE, new Document([
'$collection' => $collection->getId(),
'modified' => count($documents)
]));

return $documents;
}

Expand Down

0 comments on commit e59e6e0

Please sign in to comment.