From 753724a23cd3fd3ebf89860b78669e86b58295a0 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 14 Jan 2016 17:56:01 +0530 Subject: [PATCH] end peering in task thread if we get a 403 --- oml/nodes.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/oml/nodes.py b/oml/nodes.py index f8fe698..61d8d64 100644 --- a/oml/nodes.py +++ b/oml/nodes.py @@ -173,13 +173,13 @@ class Node(Thread): r = self._opener.open(url, data=content) except urllib.error.HTTPError as e: if e.code == 403: - logger.debug('REMOTE ENDED PEERING') - with db.session(): - u = self.user - if u.peered: - u.update_peering(False) - self.online = False - return + logger.debug('403: %s (%s)', url, self.user_id) + self._running = False + if state.tasks: + state.tasks.queue('peering', (self.user_id, False)) + del self._nodes[self.user_id] + self.online = False + return None logger.debug('urllib2.HTTPError %s %s', e, e.code) self.online = False return None