diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 20b64cbf71..2fdf777803 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -7,6 +7,7 @@ use Appwrite\Event\Delete; use Appwrite\Event\Event; use Appwrite\Event\Mail; use Appwrite\Extend\Exception; +use Appwrite\GraphQL\Schema; use Appwrite\Messaging\Adapter\Realtime; use Appwrite\Usage\Stats; use Appwrite\Utopia\Response; @@ -441,6 +442,5 @@ App::shutdown() ->inject('register') ->inject('project') ->action(function (Registry $register, Document $project) { - $projectId = $project->getId(); - $register->set($projectId . 'SchemaDirty', fn() => true); + Schema::setDirty($project->getId()); }); diff --git a/app/init.php b/app/init.php index c1045d7b51..aca2eb1297 100644 --- a/app/init.php +++ b/app/init.php @@ -1056,7 +1056,6 @@ App::setResource('servers', function () { }); App::setResource('promiseAdapter', function ($register) { - /** @var Utopia\Registry\Registry $register */ return $register->get('promiseAdapter'); }, ['register']); diff --git a/src/Appwrite/GraphQL/Schema.php b/src/Appwrite/GraphQL/Schema.php index 08f1b15c2d..09d5ee9b3b 100644 --- a/src/Appwrite/GraphQL/Schema.php +++ b/src/Appwrite/GraphQL/Schema.php @@ -16,7 +16,7 @@ use Utopia\Route; class Schema { protected static ?GQLSchema $schema = null; - protected static bool $dirty = false; + protected static array $dirty = []; /** * @throws \Exception @@ -30,7 +30,7 @@ class Schema return $utopia; }); - if (!self::$dirty && self::$schema) { + if (!empty(self::$schema)) { return self::$schema; } @@ -250,4 +250,9 @@ class Schema 'mutation' => $mutationFields ]; } + + public static function setDirty(string $projectId): void + { + self::$dirty[$projectId] = true; + } }