snapshotpl / ZfSnapGeoip

Maxmind Geoip module for Zend Framework 2
15 stars 4 forks source link

Correction Exception HttpClient Timeout #9

Closed vincequeiroz closed 9 years ago

vincequeiroz commented 9 years ago

Exception:

root@vagrant-ubuntu-trusty-64:/vagrant/erp/source/deploy# php public/index.php geoip download
Downloading http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz...
======================================================================
   The application has thrown an exception!
======================================================================
 Zend\Http\Client\Adapter\Exception\RuntimeException
 Error in cURL request: Operation timed out after 9999 milliseconds with 2548269 out of 11894972 bytes received
----------------------------------------------------------------------
/vagrant/erp/source/deploy/vendor/zendframework/zendframework/library/Zend/Http/Client/Adapter/Curl.php:422
#0 /vagrant/erp/source/deploy/vendor/zendframework/zendframework/library/Zend/Http/Client.php(1379): Zend\Http\Client\Adapter\Curl->write('GET', Object(Zend\Uri\Http), '1.1', Array, '')
#1 /vagrant/erp/source/deploy/vendor/zendframework/zendframework/library/Zend/Http/Client.php(890): Zend\Http\Client->doRequest(Object(Zend\Uri\Http), 'GET', false, Array, '')
#2 /vagrant/erp/source/deploy/vendor/snapshotpl/zf-snap-geoip/src/ZfSnapGeoip/Controller/ConsoleController.php(127): Zend\Http\Client->send()
#3 /vagrant/erp/source/deploy/vendor/snapshotpl/zf-snap-geoip/src/ZfSnapGeoip/Controller/ConsoleController.php(91): ZfSnapGeoip\Controller\ConsoleController->getDbResponse()
#4 /vagrant/erp/source/deploy/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php(83): ZfSnapGeoip\Controller\ConsoleController->downloadAction()
#5 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#6 /vagrant/erp/source/deploy/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#7 /vagrant/erp/source/deploy/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#8 /vagrant/erp/source/deploy/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php(116): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#9 /vagrant/erp/source/deploy/vendor/snapshotpl/zf-snap-geoip/src/ZfSnapGeoip/Controller/ConsoleController.php(73): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Console\Request), Object(Zend\Console\Response))
#10 /vagrant/erp/source/deploy/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php(113): ZfSnapGeoip\Controller\ConsoleController->dispatch(Object(Zend\Console\Request), Object(Zend\Console\Response))
#11 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#12 /vagrant/erp/source/deploy/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#13 /vagrant/erp/source/deploy/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#14 /vagrant/erp/source/deploy/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(313): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#15 /vagrant/erp/source/deploy/public/index.php(15): Zend\Mvc\Application->run()
#16 {main}
======================================================================
   Previous Exception(s):

Error with the try catch:

root@vagrant-ubuntu-trusty-64:/vagrant/erp/source/deploy# php public/index.php geoip download
Downloading http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz...
Error in cURL request: Resolving timed out after 1514 milliseconds
Error during file download occured

Result with HttpClient timeout option with 30 seconds.

root@vagrant-ubuntu-trusty-64:/vagrant/erp/source/deploy# php public/index.php geoip download
Downloading http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz...
Download completed
Unzip the downloading data...
Unzip completed (/vagrant/erp/source/deploy/vendor/snapshotpl/zf-snap-geoip/config/../data/GeoLiteCity.dat)
snapshotpl commented 9 years ago

Thanks @vincequeiroz ! I will review it this evening.

snapshotpl commented 9 years ago

Thanks @vincequeiroz !