amphp / mysql

An async MySQL client for PHP, optimizing database interactions with efficient non-blocking capabilities. Perfect for responsive, high-performance applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connection pool - Promise returned from advance() must resolve

NicklasWallgren opened this issue · comments

How to reproduce the issue at hand.

$pool = Amp\Mysql\pool('<connection string>');
$promise = $pool->query('SELECT 1');
$resolved = \Amp\Promise\wait($promise);

var_dump($resolved->getCurrent());

$pool->close();
Uncaught Error: Promise returned from advance() must resolve before calling this method in /Users/.../vendor/amphp/amp/lib/Internal/Producer.php on line 75

You need to call advance and await the returned promise before calling getCurrent.

Could you provide an example of this in a synchronous environment?

The example provided above works fine in earlier versions of amphp/mysql.

yeah, you're missing a \Amp\Promise\wait($resolved->advance()); before the call to getCurrent().

@bwoebi Alright, thank you!