Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
115
src/Framework/Database/AsyncAwareConnection.php
Normal file
115
src/Framework/Database/AsyncAwareConnection.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Framework\Database;
|
||||
|
||||
use App\Framework\Async\AsyncService;
|
||||
use App\Framework\Database\Contracts\AsyncCapable;
|
||||
|
||||
/**
|
||||
* Decorator der jede ConnectionInterface-Implementierung um async Property erweitert
|
||||
*
|
||||
* Usage: $db->async->queryMultiple([...])
|
||||
*/
|
||||
final readonly class AsyncAwareConnection implements ConnectionInterface, AsyncCapable
|
||||
{
|
||||
private AsyncDatabaseAdapter $asyncAdapter;
|
||||
|
||||
public function __construct(
|
||||
private ConnectionInterface $connection,
|
||||
private AsyncService $asyncService
|
||||
) {
|
||||
$this->asyncAdapter = new AsyncDatabaseAdapter($this->connection, $this->asyncService);
|
||||
}
|
||||
|
||||
// === STANDARD CONNECTION INTERFACE (Delegation) ===
|
||||
|
||||
public function execute(string $sql, array $parameters = []): int
|
||||
{
|
||||
return $this->connection->execute($sql, $parameters);
|
||||
}
|
||||
|
||||
public function query(string $sql, array $parameters = []): ResultInterface
|
||||
{
|
||||
return $this->connection->query($sql, $parameters);
|
||||
}
|
||||
|
||||
public function queryOne(string $sql, array $parameters = []): ?array
|
||||
{
|
||||
return $this->connection->queryOne($sql, $parameters);
|
||||
}
|
||||
|
||||
public function queryColumn(string $sql, array $parameters = []): array
|
||||
{
|
||||
return $this->connection->queryColumn($sql, $parameters);
|
||||
}
|
||||
|
||||
public function queryScalar(string $sql, array $parameters = []): mixed
|
||||
{
|
||||
return $this->connection->queryScalar($sql, $parameters);
|
||||
}
|
||||
|
||||
public function beginTransaction(): void
|
||||
{
|
||||
$this->connection->beginTransaction();
|
||||
}
|
||||
|
||||
public function commit(): void
|
||||
{
|
||||
$this->connection->commit();
|
||||
}
|
||||
|
||||
public function rollback(): void
|
||||
{
|
||||
$this->connection->rollback();
|
||||
}
|
||||
|
||||
public function inTransaction(): bool
|
||||
{
|
||||
return $this->connection->inTransaction();
|
||||
}
|
||||
|
||||
public function lastInsertId(): string
|
||||
{
|
||||
return $this->connection->lastInsertId();
|
||||
}
|
||||
|
||||
public function getPdo(): \PDO
|
||||
{
|
||||
return $this->connection->getPdo();
|
||||
}
|
||||
|
||||
// === ASYNC CAPABILITY ===
|
||||
|
||||
/**
|
||||
* Get async adapter for parallel operations
|
||||
*/
|
||||
public function async(): AsyncDatabaseAdapter
|
||||
{
|
||||
return $this->asyncAdapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get wrapped connection instance
|
||||
*/
|
||||
public function getWrappedConnection(): ConnectionInterface
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get statistics including async metrics
|
||||
*/
|
||||
public function getStats(): array
|
||||
{
|
||||
$baseStats = method_exists($this->connection, 'getStatistics') ? $this->connection->getStatistics() : [];
|
||||
|
||||
return array_merge($baseStats, [
|
||||
'async_enabled' => true,
|
||||
'async_stats' => $this->asyncAdapter->getStats(),
|
||||
'connection_type' => get_class($this->connection),
|
||||
'supports_read_replicas' => $this->connection instanceof ReadWriteConnection,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user