Connection pool - Promise returned from advance() must resolve
NicklasWallgren opened this issue · 4 comments
NicklasWallgren commented
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
kelunik commented
You need to call advance and await the returned promise before calling getCurrent.
NicklasWallgren commented
Could you provide an example of this in a synchronous environment?
The example provided above works fine in earlier versions of amphp/mysql.
bwoebi commented
yeah, you're missing a \Amp\Promise\wait($resolved->advance());
before the call to getCurrent().
NicklasWallgren commented
@bwoebi Alright, thank you!