fix end of peering

This commit is contained in:
j 2014-08-11 20:10:07 +02:00
parent 7ff736465f
commit 1e0f93bbf2
2 changed files with 5 additions and 3 deletions

View file

@ -221,9 +221,9 @@ class Item(db.Model):
state.db.session.commit()
def delete(self, commit=True):
state.db.session.delete(self)
Sort.query.filter_by(item_id=self.id).delete()
Transfer.query.filter_by(item_id=self.id).delete()
state.db.session.delete(self)
if commit:
state.db.session.commit()

View file

@ -141,8 +141,10 @@ class Node(Thread):
except urllib2.HTTPError as e:
if e.code == 403:
logger.debug('REMOTE ENDED PEERING')
if self.user.peered:
self.user.update_peering(False)
with db.session():
u = self.user
if u.peered:
u.update_peering(False)
self.online = False
return
logger.debug('urllib2.HTTPError %s %s', e, e.code)