avoid extra lookup

This commit is contained in:
j 2016-02-25 13:09:59 +05:30
commit d7528f634f
2 changed files with 16 additions and 17 deletions

View file

@ -445,15 +445,10 @@ class Nodes(Thread):
else:
self._call(*args)
def cleanup(self):
if not state.shutdown and self._local:
self._local.cleanup()
def pull(self):
if not self._pulling:
self.queue('pull')
def queue(self, *args):
self._q.put(list(args))
@ -493,6 +488,10 @@ class Nodes(Thread):
if send_response:
self._nodes[user_id].send_response()
def pull(self):
if not self._pulling:
self.queue('pull')
def _pull(self):
if state.activity and state.activity.get('activity') == 'import':
return
@ -503,7 +502,7 @@ class Nodes(Thread):
with db.session():
from user.models import User
for u in User.query.filter(User.id!=settings.USER_ID).filter_by(peered=True).all():
users.append(u.json())
users.append(u.json(['id', 'index', 'name']))
users.sort(key=user_sort_key)
for u in users:
if state.shutdown: