作者:Wonghowah | 来源:互联网 | 2014-05-28 16:53
mongophp扩展v1.3.2正式上线以来,每天总是会出现几条超时错误:ExceptionERROR:{Failedtoconnectto:10.15.200.86:10017:Timedoutafter1000ms}想避免这类的错误但是设置无效,比如:MongoCursor::timeout无论真么设置$mongo
mongo php 扩展v1.3.2正式上线以来, 每天总是会出现几条超时错误:
Exception ERROR: {Failed to connect to: 10.15.200.86:10017: Timed out after 1000 ms}
想避免这类的错误但是设置无效, 比如: MongoCursor::timeout无论真么设置
$mongo = new mongo(MONGO_CONNECT_STRING, array('w' => 1, 'wTimeout' => 5000));
MongoCursor::$timeout = 2000;
都无济于事, 今天看了看源码发现里面硬编码的超时时间是1000……
BUG FIXED: Fixed PHP-356 (Driver does not honour connection
‘timeout’)
(妖孽, 请放开github)
https://github.com/
mongodb/mongo-php-driver/commit/34648b73fbd5cafbeeb8f1073c065b1e4a85dc08
所以上mongo php driver
1.3.2版本的遇到需要自定义超时时间的需要升级mongo驱动到v1.3.3以后.