start callbacks on main thread

This commit is contained in:
j 2019-02-02 14:42:26 +05:30
parent c7e316ab22
commit de9a172f39

View file

@ -44,7 +44,7 @@ class Node(Thread):
self._opener = get_opener(self.user_id)
self._q = Queue()
self._pingcb = PeriodicCallback(self.ping, 10 * settings.server['pull_interval'])
self._pingcb.start()
state.main.add_callback(self._pingcb.start)
Thread.__init__(self)
self.daemon = True
self.start()
@ -512,7 +512,7 @@ class Nodes(Thread):
self.queue('add', u.id, True)
self.local = LocalNodes()
self._pullcb = PeriodicCallback(self.pull, settings.server['pull_interval'])
self._pullcb.start()
state.main.add_callback(self._pingcb.start)
Thread.__init__(self)
self.daemon = True
self.start()