Move Connections
to pools namespace
This commit is contained in:
parent
388f450d89
commit
b50ec49ac1
|
@ -2,7 +2,7 @@
|
|||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use Appwrite\Utopia\Queue\Connections;
|
||||
use Appwrite\Utopia\Pools\Connections;
|
||||
use Appwrite\Utopia\Response;
|
||||
use Swoole\Process;
|
||||
use Swoole\Http\Server;
|
||||
|
|
|
@ -33,7 +33,7 @@ use Appwrite\Network\Validator\Email;
|
|||
use Appwrite\Network\Validator\Origin;
|
||||
use Appwrite\OpenSSL\OpenSSL;
|
||||
use Appwrite\URL\URL as AppwriteURL;
|
||||
use Appwrite\Utopia\Queue\Connections;
|
||||
use Appwrite\Utopia\Pools\Connections;
|
||||
use Utopia\App;
|
||||
use Utopia\Logger\Logger;
|
||||
use Utopia\Cache\Adapter\Redis as RedisCache;
|
||||
|
|
|
@ -16,7 +16,7 @@ use Appwrite\Event\Phone;
|
|||
use Appwrite\Event\Usage;
|
||||
use Appwrite\Event\UsageDump;
|
||||
use Appwrite\Platform\Appwrite;
|
||||
use Appwrite\Utopia\Queue\Connections;
|
||||
use Appwrite\Utopia\Pools\Connections;
|
||||
use Swoole\Runtime;
|
||||
use Utopia\App;
|
||||
use Utopia\Cache\Adapter\Sharding;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Utopia\Queue;
|
||||
namespace Appwrite\Utopia\Pools;
|
||||
|
||||
use Utopia\Pools\Connection;
|
||||
|
||||
|
@ -21,16 +21,6 @@ class Connections
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
* @return Connection
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function get(string $id): Connection
|
||||
{
|
||||
return $this->connections[$id] ?? throw new \Exception("Connection '{$id}' not found");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
* @return self
|
||||
|
@ -41,14 +31,20 @@ class Connections
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return \count($this->connections);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return self
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function reclaim(): self
|
||||
{
|
||||
foreach ($this->connections as $connection) {
|
||||
foreach ($this->connections as $id => $connection) {
|
||||
$connection->reclaim();
|
||||
unset($this->connections[$id]);
|
||||
}
|
||||
|
||||
return $this;
|
Loading…
Reference in a new issue