Sometimes it takes more than the default 5 seconds for a remote API call to
complete, and I think that we need to accept that. The solution is to
increase the timeout period.

I have been using the following workaround to increase the timeout. Just
add this snippet above the rest of the import statements.

# Fix for DeadlineExceededError
# Increase the amount of time before an API call times out
#     Original code from
https://groups.google.com/forum/#!msg/google-appengine/OANTefJvn0A/uRKKHnCKr7QJ
from google.appengine.api import urlfetch
real_fetch = urlfetch.fetch
def fetch_with_deadline(url, *args, **argv):
    argv['deadline'] = settings.URL_FETCH_TIMEOUT
    logservice.flush()
    return real_fetch(url, *args, **argv)
urlfetch.fetch = fetch_with_deadline


I use a value of 10 for settings.URL_FETCH_TIMEOUT (double the default of 5
seconds). Since adding this code, I have reduced the number of
DeadlineExceededErrors from several per day to just one every few months.






On 1 June 2013 05:14, Linan Wang <[email protected]> wrote:

> after 5 years i still got this. is google appengine team impotent?
>
> On Monday, May 5, 2008 8:06:18 AM UTC+1, Cesar D. Rodas wrote:
>>
>> Hi,
>>
>> I got the following error in a page that do too many insert per time
>> (~500). I can share the code since my project is open source.
>>
>>
>> Traceback (most recent call last):
>>   File "/base/python_lib/versions/1/**google/appengine/ext/webapp/
>> __init__.py", line 499, in __call__
>>     handler.get(*groups)
>>   File "/base/data/home/apps/**textlang/1.156/setup.py", line 53, in get
>>     db_ngram.put()
>>   File "/base/python_lib/versions/1/**google/appengine/ext/db/
>> __init__.py", line 616, in put
>>     return datastore.Put(self._entity)
>>   File "/base/python_lib/versions/1/**google/appengine/api/
>> datastore.py", line 156, in Put
>>     apiproxy_stub_map.**MakeSyncCall('datastore_v3', 'Put', req, resp)
>>   File "/base/python_lib/versions/1/**google/appengine/api/
>> apiproxy_stub_map.py", line 47, in MakeSyncCall
>>     stub.MakeSyncCall(service, call, request, response)
>>   File "/base/python_lib/versions/1/**google/appengine/runtime/
>> apiproxy.py", line 245, in MakeSyncCall
>>     rpc.Wait()
>>   File "/base/python_lib/versions/1/**google/appengine/runtime/
>> apiproxy.py", line 161, in Wait
>>     rpc_completed = _apphosting_runtime___python__**apiproxy.Wait(self)
>> DeadlineExceededError
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/google-appengine?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to