From 1656c6cdebfba869b80fad18c50d67474195d30e Mon Sep 17 00:00:00 2001 From: Jimmy Rimmer Date: Mon, 11 Jan 2016 14:09:25 -0800 Subject: [PATCH] Make the same change for SessionSetDb that's in SessionSetFiles: Make get() a generator, so that memory doesn't get blown out if there are 18 million sessions there to clean up. --- scripts/sessions2trash.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/sessions2trash.py b/scripts/sessions2trash.py index bbc2f408..65758c87 100755 --- a/scripts/sessions2trash.py +++ b/scripts/sessions2trash.py @@ -104,12 +104,10 @@ class SessionSetDb(SessionSet): def get(self): """Return list of SessionDb instances for existing sessions.""" - sessions = [] table = current.response.session_db_table if table: for row in table._db(table.id > 0).select(): - sessions.append(SessionDb(row)) - return sessions + yield SessionDb(row) class SessionSetFiles(SessionSet):