From f837e6be03e171ed16474f125077ff098cf4a280 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 15 Dec 2025 09:42:26 +0200 Subject: [PATCH] cleanups --- src/Appwrite/Platform/Workers/Migrations.php | 39 ++++++++++++-------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 5d880f9baf..ebcd199ff6 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -41,18 +41,13 @@ use Utopia\System\System; class Migrations extends Action { - protected Database $dbForProject; - - protected Database $dbForPlatform; - - protected Device $deviceForMigrations; - protected Device $deviceForFiles; - - protected Document $project; - - protected array $plan; - - protected array $platform; + protected ?Database $dbForProject; + protected ?Database $dbForPlatform; + protected ?Device $deviceForMigrations; + protected ?Device $deviceForFiles; + protected ?Document $project; + protected array $plan = []; + protected array $platform = []; /** * @var array @@ -60,9 +55,9 @@ class Migrations extends Action protected array $sourceReport = []; /** - * @var callable + * @var callable|null */ - protected $logError; + protected $logError = null; public static function getName(): string { @@ -130,7 +125,21 @@ class Migrations extends Action return; } - $this->processMigration($migration, $queueForRealtime, $queueForMails); + try { + $this->processMigration($migration, $queueForRealtime, $queueForMails); + } finally { + $this->dbForProject = null; + $this->dbForPlatform = null; + $this->project = null; + $this->logError = null; + $this->deviceForMigrations = null; + $this->deviceForFiles = null; + $this->plan = []; + $this->platform = []; + $this->sourceReport = []; + + gc_collect_cycles(); + } } /**