Hi notcourage,

The following lines attempt to iterate through all of the entities in
a kind and deletes them one at a time.



all = Thing.all()
for x in all:
  ...

Since you check the time to do a redirect, it looks like this should
avoid the 30 second time limit. Do you know what kind of timeout error
you are seeing (datastore vs request deadline)?

One thing that might help is fetching a small number of entities per
request and deleting just a few at a time. It might look something
like:

db.delete(Thing.all().fetch(10))

Note, you don't need to iterate over the results of the all query as
delete will take a list of entities.

Happy coding,

Jeff


On May 20, 9:54 am, notcourage <[email protected]> wrote:
> def clearDatastore(request):
>     ti = time.clock()
>     all = Thing.all()
>     for x in all:
>         x.delete()
>         if time.clock() - ti >= 8:
>             return HttpResponseRedirect("/clearDatastore")
>
> Any ideas on why the above times out? Thx.
--~--~---------~--~----~------------~-------~--~----~
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