I'm backing guest sessions with the datastore. For the most, part,
entries get cleaned up as the user goes ("unsaved" entities get
deleted). However, there will be lingerers as the user exits the site,
etc.
What's the best means of cleaning lingerers these up? Entity has a
datetime.datetime field (called creation).
Will code this simple suffice:
def cleanDB():
"""Clean out entities older than two hours."""
results = PalettesDB.all()
for result in results:
age = datetime.datetime.now() - result.creation
if age.seconds > 7200:
db.delete(result)
How can I call it in a cron job fashion? (It doesn't necessarily need
to run with ever user's visit.)
Thanks,
Jason
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---