1
0
Fork 0
mirror of synced 2024-10-01 17:58:02 +13:00

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
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
3 changed files with 9 additions and 5 deletions

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());
});

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']);

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;
}
}