Hi,

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.

On dev_appserver, this code works perfectly.  The timeout set in the
pre-call hook is respected.  However, in production, the default time
out is never observed.  As a result, the TestFetch handler times out.
I'm logging the pre-call hook, so I know that the hook is being
installed and used.  It seems like set_deadline is just not being
observed.

I will leave up the hanging request, so that anybody can replicate the
behavior I'm seeing.  Does anyone know what might be going on?

#BELOW IS main.py IN ITS BAREST FORM
import logging
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.api import urlfetch
from google.appengine.api import apiproxy_stub_map

def urlfetch_timeout_hook(service, call, request, response):
  if call != 'Fetch':
    return
  # Make the default deadline 10 seconds instead of 5.
  if not request.has_deadline():
    request.set_deadline(10.0)
    logging.info("HAS DEADLINE: %s" % str(request.has_deadline()))

apiproxy_stub_map.apiproxy.GetPreCallHooks().Append('urlfetch_timeout_hook',
urlfetch_timeout_hook, 'urlfetch')

class TestFetch(webapp.RequestHandler):
    def get(self):
        host='http://184.72.254.178:7071'
        urlfetch.fetch(host+'/proxy')
        return
def main():

    handlers = [
        (r"/test1", TestFetch),
    ]

    application = webapp.WSGIApplication(handlers,debug=True)
    logging.getLogger().setLevel(logging.DEBUG)
    run_wsgi_app(application)

if __name__ == "__main__":
    main()

-- 
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.

Reply via email to