AppEngine's urlfetch, how to force timeout to be respected
I'm using Urlfetch from Google Appengine, and I add the deadline parameter to force the deadline to be short (3 seconds), like the following : try: urlfetch.set_default_fetch_deadline(3) return urlfetch.fetch(url='http://www.example.com', method=urlfetch.GET, deadline=3) except google.appengine.runtime.apiproxy_errors.DeadlineExceededError: pass except google.appengine.api.urlfetch_errors.DeadlineExceededError: pass return None But no matter what, my thread goes on and on for 60 seconds (the max execution time for an http request on Appengine) and then fail miserably on a DeadlineException ("Thread running after request."). Is there a way to ensure that the upper query will be strictly stopped in 3 seconds?
I can share some code I currently have running in one of my production projects. I use a deadline of 0.5 seconds in this example. Last I checked, it's still working: t_rpc = urlfetch.create_rpc(deadline=0.5) urlfetch.make_fetch_call(t_rpc, url) # and then later... try: result = t_rpc.get_result() except: # handle errors... pass # use the result... This is actually using the asynchronous version of the API so you can technically do things in between calling make_fetch_call and get_result. Otherwise, you can just call them back-to-back and it will function the same as a synchronous API.
GAE 1.7.3 - How to debug appengine-web.xml XML error validating
How to setup data fixtures in Google App Engine for Go
How to write a JDO Query to sort result based on long attribute?
GAE doesn't import gflags
Real time notification system on Google App Engine(GAE)
How can I easily get a list of the indexed terms from a search index in the google appengine full text search api in java?
jpa #version on google appengine with #OneToMany: appengine bug or usage error?
How can I delete old backup via cron?
Error on itext-gae.jar
How to get the original from address in a forwarded message in google app engine?
Cannot authorize my google app to access my Cloud SQL instance
GooglePlaces autocomplete - more than one input
Import GAE data through Storage into BigQuery fails
Google AppEngine Tutorial, difference between code snippets
OpenID sign in not working in Gmail contextual gadget
Problems getting a basic JAXRS + JPA version working on GAE