summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/tracking.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/tracking.py b/modules/tracking.py
index 43435a1..031748b 100644
--- a/modules/tracking.py
+++ b/modules/tracking.py
@@ -346,6 +346,11 @@ class Module:
self.irc.msg(target, msg.encode('utf-8'))
session.delete(package)
removed = True
+ # empty consignment and 30 days old
+ if len(consignment.packages) == 0 and consignment.added < datetime.datetime.utcnow() - datetime.timedelta(hours = 24*30):
+ msg = '%s: Removing stale consignment \002%s\002%s' % (consignment.nick, consignment.code, label)
+ self.irc.msg(target, msg.encode('utf-8'))
+ session.delete(consignment)
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'))