summaryrefslogtreecommitdiff
path: root/modules/tracking.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/tracking.py')
-rw-r--r--modules/tracking.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/modules/tracking.py b/modules/tracking.py
index 0d34b17..1b7428c 100644
--- a/modules/tracking.py
+++ b/modules/tracking.py
@@ -293,15 +293,6 @@ class Module:
consignment = session.query(Consignment).filter(Consignment.code == code).one()
self.update_consignment(session, consignment, announce)
session.commit()
- except IntegrityError as e:
- # assume several packets within the same consignment was added as a consignment
- target = consignment.channel or consignment.nick
- target = target.encode('utf-8')
- session.rollback()
- session.delete(consignment)
- session.commit()
- if announce:
- self.irc.msg(target, '%s: \002%s\002 conflicts with another consignment - tracking stopped' % (target, code))
finally:
session.close()
@@ -354,7 +345,16 @@ class Module:
consignments = session.query(Consignment).filter(Consignment.channel.in_(config.get(self.irc.factory.server, 'channels').split()))
for row in consignments:
self.update_consignment(session, row)
- session.commit()
+ try:
+ session.commit()
+ except IntegrityError as e:
+ # assume several packets within the same consignment was added as a consignment
+ target = consignment.channel or consignment.nick
+ target = target.encode('utf-8')
+ session.rollback()
+ session.delete(consignment)
+ session.commit()
+ self.irc.msg(target, '%s: \002%s\002 conflicts with another consignment - tracking stopped' % (target, code))
finally:
session.close()