don't create user in response

This commit is contained in:
j 2016-03-01 17:08:58 +05:30
parent 490acdbd23
commit 771c8b205e

View file

@ -202,12 +202,16 @@ class Node(Thread):
def _send_response(self): def _send_response(self):
with db.session(): with db.session():
u = user.models.User.get_or_create(self.user_id) u = user.models.User.get(self.user_id)
if u.peered or u.queued: if u and u.peered or u.queued:
if DEBUG_NODES: if DEBUG_NODES:
logger.debug('go online peered=%s queued=%s %s (%s)', u.peered, u.queued, u.id, u.nickname) logger.debug('go online peered=%s queued=%s %s (%s)', u.peered, u.queued, u.id, u.nickname)
try: try:
self.online = self.can_connect() self.online = self.can_connect()
except:
if DEBUG_NODES:
logger.debug('failed to connect to %s', self.user_id)
self.online = False
if self.online: if self.online:
if DEBUG_NODES: if DEBUG_NODES:
logger.debug('connected to %s', self.url) logger.debug('connected to %s', self.url)
@ -221,10 +225,6 @@ class Node(Thread):
else: else:
#fixme, what about cancel/reject peering here? #fixme, what about cancel/reject peering here?
self.peering('removePeering') self.peering('removePeering')
except:
if DEBUG_NODES:
logger.debug('failed to connect to %s', self.user_id)
self.online = False
def trigger_status(self): def trigger_status(self):
if self.online is not None: if self.online is not None: