summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-03-29 16:36:20 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2011-03-29 16:36:20 +0200
commit5dee876e9956203f24da46a52021a16b211d6058 (patch)
tree2a1983a5c8b9e4b126e42cea9f119a18f300d8b5 /modules
parent722cbca65f37a7e265a9e45d320e8319cd51bfa8 (diff)
tracking: Remove stale empty consignments.
Diffstat (limited to 'modules')
-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'))