mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
refactor(insights): register CTA registry on the global $register
Persist the insight CTA registry across requests by attaching it to the boot-time global $register, mirroring the pattern used for `geodb`, `passwordsDictionary`, `hooks`, etc. The container resource now looks the registry up from `$register` instead of rebuilding it on every request. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
3c4aceea48
commit
d188bd7a2e
@@ -3,6 +3,7 @@
|
||||
use Appwrite\Extend\Exception;
|
||||
use Appwrite\GraphQL\Promises\Adapter\Swoole;
|
||||
use Appwrite\Hooks\Hooks;
|
||||
use Appwrite\Insights\Cta\Action\DatabasesCreateIndex;
|
||||
use Appwrite\PubSub\Adapter\Redis as PubSub;
|
||||
use Appwrite\URL\URL as AppwriteURL;
|
||||
use MaxMind\Db\Reader;
|
||||
@@ -451,6 +452,11 @@ $register->set('promiseAdapter', function () {
|
||||
$register->set('hooks', function () {
|
||||
return new Hooks();
|
||||
});
|
||||
$register->set('insightCtaRegistry', function () {
|
||||
$registry = new Registry();
|
||||
$registry->set(DatabasesCreateIndex::getName(), fn () => new DatabasesCreateIndex());
|
||||
return $registry;
|
||||
});
|
||||
$listeners = require __DIR__ . '/../listeners.php';
|
||||
$register->set('bus', function () use ($listeners) {
|
||||
$bus = new \Utopia\Bus\Bus();
|
||||
|
||||
@@ -8,7 +8,6 @@ use Appwrite\Event\Publisher\Migration as MigrationPublisher;
|
||||
use Appwrite\Event\Publisher\Screenshot as ScreenshotPublisher;
|
||||
use Appwrite\Event\Publisher\StatsResources as StatsResourcesPublisher;
|
||||
use Appwrite\Event\Publisher\Usage as UsagePublisher;
|
||||
use Appwrite\Insights\Cta\Action\DatabasesCreateIndex;
|
||||
use Appwrite\Utopia\Database\Documents\User;
|
||||
use Executor\Executor;
|
||||
use Utopia\Abuse\Adapters\TimeLimit\Redis as TimeLimitRedis;
|
||||
@@ -27,7 +26,6 @@ use Utopia\Pools\Group;
|
||||
use Utopia\Queue\Broker\Pool as BrokerPool;
|
||||
use Utopia\Queue\Publisher;
|
||||
use Utopia\Queue\Queue;
|
||||
use Utopia\Registry\Registry as UtopiaRegistry;
|
||||
use Utopia\Storage\Device;
|
||||
use Utopia\Storage\Device\AWS;
|
||||
use Utopia\Storage\Device\Backblaze;
|
||||
@@ -130,11 +128,9 @@ $container->set('authorization', function () {
|
||||
return new Authorization();
|
||||
}, []);
|
||||
|
||||
$container->set('insightCtaRegistry', function () {
|
||||
$registry = new UtopiaRegistry();
|
||||
$registry->set(DatabasesCreateIndex::getName(), fn () => new DatabasesCreateIndex());
|
||||
return $registry;
|
||||
}, []);
|
||||
$container->set('insightCtaRegistry', function ($register) {
|
||||
return $register->get('insightCtaRegistry');
|
||||
}, ['register']);
|
||||
|
||||
$container->set('dbForPlatform', function (Group $pools, Cache $cache, Authorization $authorization) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user