I'm testing my application (on [Google App Engine](http://en.wikipedia.org/wiki/Google_App_Engine) live servers) and the way I've written it I have about 40 db.GqlQuery() statements in my code (mostly part of classes).

I keep getting db.Timeout *very often* though.

How do I deal with this? I was going to surround all my queries with really brutal code like this:

```

  querySucceeded = False
  while not querySucceeded :
    try :
      result = db.GqlQuery( """xxx""" ).get()
      querySucceeded = True #only get here if above line doesn't raise exc
    except :
      querySucceeded = False

```

Is this ok? Do you agree? What's a better way to deal with db.Timeouts?

### Edit:

I now use this for any get queries

```

""" Query gets single result """
def queryGet( gql ) :
  querySucceeded = False
  while not querySucceeded :
    try :
      result = db.GqlQuery( gql ).get()
      querySucceeded = True #only get here if above line doesn't raise
    except :
      querySucceeded = False

  return result

```

I have similar functions for fetch and count.