Skip to content

Commit

Permalink
chore: more robust delete entity handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jeabakker committed Aug 12, 2024
1 parent b2d4fbc commit a9452dc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions classes/ColdTrick/OpenSearch/EventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,13 @@ protected static function updateEntity(\ElggEntity $entity): void {
* @return void
*/
protected static function deleteEntity(\ElggEntity $entity): void {
$last_indexed = $entity->{OPENSEARCH_INDEXED_NAME};
if (elgg_is_empty($last_indexed)) {
return;
try {
$last_indexed = $entity->{OPENSEARCH_INDEXED_NAME};
if (elgg_is_empty($last_indexed)) {
return;
}
} catch (\Elgg\Exceptions\ExceptionInterface $e) {
// unable to determine if the entity should be removed, so remove it just to be safe
}

$service = IndexingService::instance();
Expand Down

0 comments on commit a9452dc

Please sign in to comment.