Set dirty property instead of in registry from shutdown

This commit is contained in:
Jake Barnby
2022-10-13 12:59:32 +13:00
parent 5c5bdac3d9
commit a2b532ed22
3 changed files with 9 additions and 5 deletions
+2 -2
View File
@@ -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());
});
-1
View File
@@ -1056,7 +1056,6 @@ App::setResource('servers', function () {
});
App::setResource('promiseAdapter', function ($register) {
/** @var Utopia\Registry\Registry $register */
return $register->get('promiseAdapter');
}, ['register']);
+7 -2
View File
@@ -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;
}
}