end peering in task thread if we get a 403
This commit is contained in:
parent
78e48e65bd
commit
753724a23c
1 changed files with 7 additions and 7 deletions
12
oml/nodes.py
12
oml/nodes.py
|
@ -173,13 +173,13 @@ class Node(Thread):
|
||||||
r = self._opener.open(url, data=content)
|
r = self._opener.open(url, data=content)
|
||||||
except urllib.error.HTTPError as e:
|
except urllib.error.HTTPError as e:
|
||||||
if e.code == 403:
|
if e.code == 403:
|
||||||
logger.debug('REMOTE ENDED PEERING')
|
logger.debug('403: %s (%s)', url, self.user_id)
|
||||||
with db.session():
|
self._running = False
|
||||||
u = self.user
|
if state.tasks:
|
||||||
if u.peered:
|
state.tasks.queue('peering', (self.user_id, False))
|
||||||
u.update_peering(False)
|
del self._nodes[self.user_id]
|
||||||
self.online = False
|
self.online = False
|
||||||
return
|
return None
|
||||||
logger.debug('urllib2.HTTPError %s %s', e, e.code)
|
logger.debug('urllib2.HTTPError %s %s', e, e.code)
|
||||||
self.online = False
|
self.online = False
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue