-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mysql\Pool::setCharset() runs forever #10
Comments
P.S: The unmodified version of If it's expected to run in 7, just close this one, I'm fine :) Great job btw. $ php -v
PHP 7.0.0-dev (cli) (built: Feb 15 2015 23:06:04) |
@douggr I believe the reason you're getting this result is ... When you create a new @bwoebi you generally want to return a promise from In the case of the $promises = [];
foreach ($this->connections as $conn) {
if ($conn->alive()) {
$promises[] = $conn->setCharset($charset, $collate);
}
}
return all($promises); |
That's fine if you want to do it transparently and not return a promise, but if so you just need to track the internal connection state yourself so the operation doesn't error out if it's invoked before the connection is established. @douggr Just as an FYI ... in the future yielding something like the mysql pool instance will result in an error as it's not actually a "yieldable" thing ( run(function() {
echo "tick\n";
yield "pause" => 1000;
echo "tick\n";
yield "pause" => 1000;
echo "tick\n";
}); |
@rdlowrey Yes, I'll look into it now... But a setCharset() is just a configuration thing and shouldn't throw any exceptions nor return any success value. So promise is not needed. |
Thanks for the feedback guys. @rdlowrey Yes, I understand the @bwoebi Although I still have no idea where's the problem is, I realized You can't just connect and then close the connection if no one query is A workaround I'm using for now is |
I found the issue, which is basically a missing check. Will fix shortly, but I've found another issue while working on this :-) (indefinite loop) |
Fixed via efddc15 // That other issue in reality was an uv-related issue which was already fixed in amphp/amp but not yet tagged (sigh). |
awkwardly it runs forever.
If I
yield $db->setCharset("latin1_general_ci");
it's runs, but I still getan exception with message 'Connection not ready, cannot send any packets' in
Connection.php:1647'.
In other way if I
yield $db->query("SET NAMES 'latin1' COLLATE 'latin1_general_ci'");
(replacing
setCharset()
) it runs flawlessly.Looks like
Pool::$connections
is never filled upon__construct
, only if you use$db = (yield new Mysql\Pool(DSN));
thenPool::$connectios
has 1 item (as expected?),but still can't use
$db->setCharset
directly, I needed toyield $db->setCharset("latin1_general_ci");
.Thoughts?
The text was updated successfully, but these errors were encountered: