From 84f4a5dba0420d1e150705efa7cffd4f79a17845 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 11 Jun 2025 22:11:43 +0530 Subject: [PATCH] added logging of errors instead of throwing --- src/Appwrite/Platform/Workers/Migrations.php | 27 ++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 395ec1351e..f8e302089e 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -279,20 +279,21 @@ class Migrations extends Action ); /** Start Transfer */ - $migration->setAttribute('stage', 'migrating'); - $this->updateMigrationDocument($migration, $projectDocument, $queueForRealtime); - - $transfer->run( - $migration->getAttribute('resources'), - function () use ($migration, $transfer, $projectDocument, $queueForRealtime) { - $migration->setAttribute('resourceData', json_encode($transfer->getCache())); - $migration->setAttribute('statusCounters', json_encode($transfer->getStatusCounters())); - $this->updateMigrationDocument($migration, $projectDocument, $queueForRealtime); - }, - $migration->getAttribute('resourceId'), - $migration->getAttribute('resourceType') - ); + if (empty($source->getErrors())) { + $migration->setAttribute('stage', 'migrating'); + $this->updateMigrationDocument($migration, $projectDocument, $queueForRealtime); + $transfer->run( + $migration->getAttribute('resources'), + function () use ($migration, $transfer, $projectDocument, $queueForRealtime) { + $migration->setAttribute('resourceData', json_encode($transfer->getCache())); + $migration->setAttribute('statusCounters', json_encode($transfer->getStatusCounters())); + $this->updateMigrationDocument($migration, $projectDocument, $queueForRealtime); + }, + $migration->getAttribute('resourceId'), + $migration->getAttribute('resourceType') + ); + } $destination->shutDown(); $source->shutDown();