From 41a3a9011fd62db2b0d9f1fd574163de916183f9 Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 27 Jun 2012 16:34:51 +0200 Subject: [PATCH] Delete 4 week old notifications on start --- couchpotato/core/notifications/core/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/couchpotato/core/notifications/core/main.py b/couchpotato/core/notifications/core/main.py index 5c72e32e..a37a6667 100644 --- a/couchpotato/core/notifications/core/main.py +++ b/couchpotato/core/notifications/core/main.py @@ -54,6 +54,14 @@ class CoreNotifier(Notification): addNonBlockApiView('notification.listener', (self.addListener, self.removeListener)) addApiView('notification.listener', self.listener) + addEvent('app.load', self.clean) + + def clean(self): + + db = get_session() + db.query(Notif).filter(Notif.added <= (int(time.time()) - 2419200)).delete() + db.commit() + def markAsRead(self):