From bf4d620a5cc3b01825532843e1e58cb43317ccd2 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Mon, 1 Jun 2026 13:30:10 +0100 Subject: [PATCH] chore: let deleteByGroup failures reach the worker error handler Previously a failed batch delete was caught and swallowed, acking the message as if it succeeded even though the documents remained. Let the error propagate so the worker marks the message failed and retries. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Modules/Databases/Workers/Databases.php | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php b/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php index cb3e7078a0..2474ed99f4 100644 --- a/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php +++ b/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php @@ -610,23 +610,20 @@ class Databases extends Action * @param Database $database * @param callable|null $callback * @return void - * @throws Exception + * @throws \Throwable */ protected function deleteByGroup(string $collectionId, array $queries, Database $database, ?callable $callback = null): void { Span::add('delete_by_group.collection.id', $collectionId); - try { - $count = $database->deleteDocuments( - $collectionId, - $queries, - Database::DELETE_BATCH_SIZE, - $callback - ); - } catch (\Throwable $th) { - Span::add('delete_by_group.error', $th->getMessage()); - return; - } + // A failed batch delete is non-recoverable: let it propagate to the + // worker's error handler so the message is marked failed and retried. + $count = $database->deleteDocuments( + $collectionId, + $queries, + Database::DELETE_BATCH_SIZE, + $callback + ); Span::add('delete_by_group.count', $count); }