Hi Marzia,

  Thanks again for the help.  I've done some careful tracing through
my code to document exactly the number of datastore requests on a
typical failure.  I believe they are very minimal but I'd be very
interested to hear your advice.

> Is that the only datastore query in the request, or does the request also
> contain other datastore queries?  To clarify, it may be timing out here as a
> result of the total number of results fetched in the entire request.

Here is a list of the datastore gets and puts that are called, in
order for a typical failed execution.  There are no queries which
return more than a single Entity and I tried to grab the database
Entities directly by id when possible:

    # Grabs a single player out of the database by id
    self.db = datamodel.PlayerDb2.get(db.Key(id))

    # Checks the state of a single room (by id)
    self.db = id
    data = self.db.state

    # For the current player, checks the list of drawers
    # to verify the player is not next to draw
    if self.db.wannaDrawList and len(self.db.wannaDrawList):
      return self.db.wannaDrawList[0]

    # Updates the player's last connection time and
    # puts it back into the database
    self.db.lastPing = time
    self.db.put()

I just did a scan of my recent errors in my logs and it appears that
the total execution time for all of the above commands (plus the logic
surrounding it) is about 80 to 130ms.  This part never seems to time
out--but the problem query below seems to hang for several seconds
before regularly timing out.  In addition, I used to have many more
database accesses in this part of the code before and those have all
been removed in order to try to fix the consistent time outs for the
"pruneInactive" function.  So far I've never been able to move the
timeout around or see it fail in another place.

Here is the current version of the pruneInactive function where the
timeout happens:

------ Code Snippet ------

        # first, grab all the players who's ping is older than 10
seconds in our room
        # 8 maximum players per room
        query = datamodel.PlayerDb2.all()
        query.filter("room =", self.db.room)
        query.filter("lastPing <", time.time() - TIMEOUT_TIME)

        logging.debug("Query is built\n")

        # Run the query for up to 5 players
        results = query.fetch(5)  # this is the timeout line
        logging.debug("Query is executed (limit 5)\n")

            ...

------ End Code Snippet ------

Thanks again for your help with this confusing issue.  (At least it's
confusing to me!)

Sincerely,

Rob



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