fix end of peering
This commit is contained in:
parent
7ff736465f
commit
1e0f93bbf2
2 changed files with 5 additions and 3 deletions
|
@ -221,9 +221,9 @@ class Item(db.Model):
|
||||||
state.db.session.commit()
|
state.db.session.commit()
|
||||||
|
|
||||||
def delete(self, commit=True):
|
def delete(self, commit=True):
|
||||||
state.db.session.delete(self)
|
|
||||||
Sort.query.filter_by(item_id=self.id).delete()
|
Sort.query.filter_by(item_id=self.id).delete()
|
||||||
Transfer.query.filter_by(item_id=self.id).delete()
|
Transfer.query.filter_by(item_id=self.id).delete()
|
||||||
|
state.db.session.delete(self)
|
||||||
if commit:
|
if commit:
|
||||||
state.db.session.commit()
|
state.db.session.commit()
|
||||||
|
|
||||||
|
|
|
@ -141,8 +141,10 @@ class Node(Thread):
|
||||||
except urllib2.HTTPError as e:
|
except urllib2.HTTPError as e:
|
||||||
if e.code == 403:
|
if e.code == 403:
|
||||||
logger.debug('REMOTE ENDED PEERING')
|
logger.debug('REMOTE ENDED PEERING')
|
||||||
if self.user.peered:
|
with db.session():
|
||||||
self.user.update_peering(False)
|
u = self.user
|
||||||
|
if u.peered:
|
||||||
|
u.update_peering(False)
|
||||||
self.online = False
|
self.online = False
|
||||||
return
|
return
|
||||||
logger.debug('urllib2.HTTPError %s %s', e, e.code)
|
logger.debug('urllib2.HTTPError %s %s', e, e.code)
|
||||||
|
|
Loading…
Reference in a new issue