Move Connections to pools namespace

This commit is contained in:
Jake Barnby
2024-04-09 20:26:42 +12:00
parent 388f450d89
commit b50ec49ac1
4 changed files with 11 additions and 15 deletions
@@ -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;