Re: [Product-Developers] Timeout decorator on external service call

2011-12-07 Thread pingviini
Third option would be to modify global socket timeout just for this request and set it back to default after request is processed and/ or timeouts are handled. Same problems can actually hit you with Plone RSS portlet. Feedparser doesn't support setting the timeout for the request even though it

Re: [Product-Developers] Timeout decorator on external service call

2011-12-07 Thread ajung
Jukka Ojaniemi wrote Third option would be to modify global socket timeout just for this request and set it back to default after request is processed and/ or timeouts are handled. Sorry but this is a pretty stupid idea. Don't touch global timeout..it will break your neck earlier or

Re: [Product-Developers] Timeout decorator on external service call

2011-12-07 Thread mcelotti
It could be useful for somebody else, so here's a possible solution: http://opensourcehacker.com/2011/08/02/ajax-proxy-view-with-python-urllib-and-plone/ Checkout the socket.setdefaulttimeout(10) section. It's not a great solution (as pointed out by ajung) but it works, and the finally block

Re: [Product-Developers] Timeout decorator on external service call

2011-12-06 Thread mcelotti
Yes, that's what happens, all threads busy and waiting for a response. Any idea is really appreciated. Thanks, Marco -- View this message in context: http://plone.293351.n2.nabble.com/Timeout-decorator-on-external-service-call-tp7063682p7066429.html Sent from the Product Developers mailing list

Re: [Product-Developers] Timeout decorator on external service call

2011-12-06 Thread Dylan Jay
You have two choices. 1. either handle the request using another framework that is much lighter weight such as pyramid, grok. pyramid running on gevent is a good choice. 2. create a 2nd set zope instances which more threads per process and lower zodb cache so you can have more to handle

[Product-Developers] Timeout decorator on external service call

2011-12-05 Thread mcelotti
Hi, I use YouTube Data API ( http://code.google.com/apis/youtube/1.0/developers_guide_python.html http://code.google.com/apis/youtube/1.0/developers_guide_python.html ) to fetch videos and other youtube informations. Sometimes (not that often, but it happened) the python call freezes while waiting

Re: [Product-Developers] Timeout decorator on external service call

2011-12-05 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 It's truly not recommendable calling external webservice from within a worker thread. If all of the (four) worker threads of Zope run into a timeout then you are doomed. Your complete system will be blocked and modifying the socket time out is also a