Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

cannot setting timeout #54

Open
consatan opened this issue Mar 23, 2021 · 0 comments
Open

cannot setting timeout #54

consatan opened this issue Mar 23, 2021 · 0 comments

Comments

@consatan
Copy link

consatan commented Mar 23, 2021

$pg = new \Swoole\Coroutine\PostgreSQL();
$dsn = 'host=localhost;dbname=test;user=user;password=pswd';
$pg->connect($dsn);

$res = $pg->query('select name from users where id=1');
$pg->fetchRow($res); // it's ok

$res = $pg->query('select name, pg_sleep(4) from users where id=1');
echo $pg->error; // ontimeout

$res = $pg->query('select name from users where id=1');
if ($res) {
    $pg->fetchRow($res);
} else {
    // goto here
    echo $pg->error; // ontimeout
}

if (!$pg->connect($dsn)) {
    echo $pg->error; // ontimeout
}

$pg = new \Swoole\Coroutine\PostgreSQL();
$pg->connect($dsn);
$res = $pg->query('select name from users where id=1');
$pg->fetchRow($res); // it's ok

at swoole_postgresql_coro.cc#353

object->timeout = SW_PGSQL_CONNECT_TIMEOUT;

SW_PGSQL_CONNECT_TIMEOUT defined to 3.0

no method set the timeout value now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant