On Thursday, March 3, 2011 9:37:21 PM UTC, Aaron wrote:
>
> In my testing, it seems like setting a default deadline for urlfetch
> is not working in production. I have replicated the behavior that I'm
> seeing in the barest form below. Essentially, I'm trying to do a GET
> request for a URL that hangs for six seconds before returning. With
> the default time out of 5 on urlfetch, this times out. So, I'm trying
> to use a pre-call hook to extend the default timeout to 10 seconds.
> ...
We were talking on IRC and solved this with a monkey patch method to setup a
custom default deadline. Just add the following before you directly or
indirectly import urlfetch. In Aaron's case, urlfetch is being used via
httplib.
from google.appengine.api import urlfetch
real_fetch = urlfetch.fetch
def fetch_with_deadline(url, *args, **argv):
argv.setdefault('deadline', 10)
return real_fetch(url, *args, **argv)
urlfetch.fetch = fetch_with_deadline
--dave
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.