We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
connect_timeout
pgsql-swoole
1 parent 3f648e7 commit 7763fceCopy full SHA for 7763fce
1 file changed
src/Connectors/PostgresSqlSwooleExtConnector.php
@@ -48,14 +48,20 @@ public function createConnection(array $config): PostgreSQL
48
{
49
$connection = new PostgreSQL();
50
51
- $result = $connection->connect(sprintf(
+ $conn = sprintf(
52
'host=%s port=%s dbname=%s user=%s password=%s',
53
$config['host'],
54
$config['port'],
55
$config['database'],
56
$config['username'],
57
$config['password']
58
- ));
+ );
59
+
60
+ if (isset($config['pool']['connect_timeout'])) {
61
+ $result = $connection->connect($conn, $config['pool']['connect_timeout']);
62
+ } else {
63
+ $result = $connection->connect($conn);
64
+ }
65
66
if ($result === false) {
67
throw new Exception($connection->error ?? 'Create connection failed, Please check the database configuration.');
0 commit comments