mirror of
https://github.com/appwrite/appwrite
synced 2026-05-14 20:48:45 +00:00
This reverts commitbf9deb09f5, reversing changes made tod312fe22ff. # Conflicts: # app/cli.php # app/init/registers.php # composer.lock # src/Appwrite/Messaging/Adapter/Realtime.php # src/Appwrite/Platform/Tasks/ScheduleBase.php # src/Appwrite/Platform/Tasks/ScheduleExecutions.php # src/Appwrite/Platform/Tasks/ScheduleFunctions.php # src/Appwrite/Platform/Tasks/ScheduleMessages.php
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Appwrite\PubSub\Adapter;
|
|
|
|
use Appwrite\PubSub\Adapter;
|
|
use Utopia\Database\Exception as DatabaseException;
|
|
use Utopia\Pools\Pool as UtopiaPool;
|
|
|
|
class Pool implements Adapter
|
|
{
|
|
public function __construct(private UtopiaPool $pool)
|
|
{
|
|
}
|
|
|
|
public function ping($message = null): bool
|
|
{
|
|
return $this->delegate(__FUNCTION__, \func_get_args());
|
|
}
|
|
|
|
public function subscribe($channels, $callback): void
|
|
{
|
|
$this->delegate(__FUNCTION__, \func_get_args());
|
|
}
|
|
|
|
public function publish($channel, $message): void
|
|
{
|
|
$this->delegate(__FUNCTION__, \func_get_args());
|
|
}
|
|
|
|
/**
|
|
* Forward method calls to the internal adapter instance via the pool.
|
|
*
|
|
* Required because __call() can't be used to implement abstract methods.
|
|
*
|
|
* @param string $method
|
|
* @param array<mixed> $args
|
|
* @return mixed
|
|
* @throws DatabaseException
|
|
*/
|
|
public function delegate(string $method, array $args): mixed
|
|
{
|
|
return $this->pool->use(function (Adapter $adapter) use ($method, $args) {
|
|
return $adapter->{$method}(...$args);
|
|
});
|
|
}
|
|
}
|