joerussbowman / gaeutilities

gaeutilities - A collection of utilities to help with application development on Google Appengine
http://gaeutilities.appspot.com
BSD 3-Clause "New" or "Revised" License
78 stars 4 forks source link

Add log output when cleaning old session #27

Open miohtama opened 13 years ago

miohtama commented 13 years ago

For this action:

  if random.randint(1, 100) < clean_check_percent:
        self._clean_old_sessions() 

I suggest adding logger output, so the admin knows when this is happening as this might be potentially long running operation and cause DeadlineExceeded:

  if random.randint(1, 100) < clean_check_percent:
        logger.info("Cleaning up old session)"
        self._clean_old_sessions() 

... otherwise you might make your sysadmins wonder what's going on.

http://blog.mfabrik.com/2011/03/11/google-app-engine-issues-with-dynamic-instances-and-deadlineexceedederrors/

joerussbowman commented 13 years ago

Well that's kind of a chicken and egg issue. If it hits DeadlineExceeded appengine is going to shutdown the request, and report that error message.

As the suggestion was put in your comments, you may want to first try disabling the garbage collection feature and testing to see if you still have issues. I do see that performance could be approved for the garbage collection, I guess I wrote it before batch deletes were an option, or for some reason I just didn't do it. So I'll clean that up when I get chance.

For any advanced logging, I'd prefer a debug mode be built into the library to support that, but the fact is I just don't have the time to add new features to this project, especially as I'm not using appengine anymore.