Exemplo n.º 1
0
def sessions_cleaner():
    """Sessions expiration maintainer"""
    timestamp = int(time.time())
    print "cleanning sessions... " + str(timestamp)
    def _callback(result, error):
        if result and result['n'] > 0:
            print "%i sessions cleaned up!" % result['n']
    sessions = Sessions()
    sessions.remove(({'__expires': {'$lt': timestamp}}),
                    callback=_callback)
Exemplo n.º 2
0
def sessions_cleaner():
    """Sessions expiration maintainer"""
    timestamp = int(time.time())
    logging.debug("cleanning sessions... %i", timestamp)

    def _callback(result, error):
        if result and result['n'] > 0:
            logging.debug("%i sessions cleaned up!", result['n'])
    sessions = Sessions()
    sessions.remove(({'__expires': {'$lt': timestamp}}),
                    callback=_callback)