From 722cbca65f37a7e265a9e45d320e8319cd51bfa8 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Thu, 17 Mar 2011 21:45:41 +0100 Subject: tracking: Remove stale packages. --- modules/tracking.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/tracking.py b/modules/tracking.py index 3533ee9..43435a1 100644 --- a/modules/tracking.py +++ b/modules/tracking.py @@ -341,6 +341,11 @@ class Module: session.add(package) if announce: self.irc.msg(target, msg) + elif package.last != None and package.last < datetime.datetime.utcnow() - datetime.timedelta(hours = 24*30): + msg = '%s: Removing stale package \002%s\002%s' % (consignment.nick, consignment.code, label) + self.irc.msg(target, msg.encode('utf-8')) + session.delete(package) + removed = True if removed and len(consignment.packages) == 0: msg = '%s: \002%s\002%s is no longer being tracked' % (consignment.nick, consignment.code, label) self.irc.msg(target, msg.encode('utf-8')) -- cgit v1.2.3