1
0
Fork 0
mirror of synced 2024-06-02 10:54:44 +12:00

Move Connections to pools namespace

This commit is contained in:
Jake Barnby 2024-04-09 20:26:42 +12:00
parent 388f450d89
commit b50ec49ac1
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
4 changed files with 11 additions and 15 deletions

View file

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

View file

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

View file

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

View file

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