mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 15:26:30 +03:00
improve debugging
This commit is contained in:
@@ -615,8 +615,14 @@ class Account(object):
|
|||||||
# the following wait is left out for now because it can fail if
|
# the following wait is left out for now because it can fail if
|
||||||
# a) python code holds an extra self._dc_context reference
|
# a) python code holds an extra self._dc_context reference
|
||||||
# b) the core does not manage to send a NULL through get_next_event()
|
# b) the core does not manage to send a NULL through get_next_event()
|
||||||
# self.log("wait for event thread to finish")
|
self.log("wait for event thread to finish")
|
||||||
# self._event_thread.wait()
|
try:
|
||||||
|
self._event_thread.wait(timeout=2)
|
||||||
|
except RuntimeError as e:
|
||||||
|
self.log("Could not wait for thread: {}".format(e))
|
||||||
|
|
||||||
|
if self._event_thread.is_alive():
|
||||||
|
self.log("WARN: event thread did not terminate")
|
||||||
|
|
||||||
self._shutdown_event.set()
|
self._shutdown_event.set()
|
||||||
|
|
||||||
|
|||||||
@@ -151,12 +151,12 @@ class EventThread(threading.Thread):
|
|||||||
def mark_shutdown(self):
|
def mark_shutdown(self):
|
||||||
self._marked_for_shutdown = True
|
self._marked_for_shutdown = True
|
||||||
|
|
||||||
def wait(self):
|
def wait(self, timeout=None):
|
||||||
if self == threading.current_thread():
|
if self == threading.current_thread():
|
||||||
# we are in the callback thread and thus cannot
|
# we are in the callback thread and thus cannot
|
||||||
# wait for the thread-loop to finish.
|
# wait for the thread-loop to finish.
|
||||||
return
|
return
|
||||||
self.join()
|
self.join(timeout=timeout)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
""" get and run events until shutdown. """
|
""" get and run events until shutdown. """
|
||||||
|
|||||||
@@ -234,7 +234,9 @@ def acfactory(pytestconfig, tmpdir, request, session_liveconfig, data):
|
|||||||
ac.addr = ac.get_self_contact().addr
|
ac.addr = ac.get_self_contact().addr
|
||||||
ac.set_config("displayname", logid)
|
ac.set_config("displayname", logid)
|
||||||
if not quiet:
|
if not quiet:
|
||||||
ac.add_account_plugin(FFIEventLogger(ac))
|
logger = FFIEventLogger(ac)
|
||||||
|
logger.init_time = self.init_time
|
||||||
|
ac.add_account_plugin(logger)
|
||||||
self._accounts.append(ac)
|
self._accounts.append(ac)
|
||||||
return ac
|
return ac
|
||||||
|
|
||||||
@@ -245,7 +247,6 @@ def acfactory(pytestconfig, tmpdir, request, session_liveconfig, data):
|
|||||||
self.offline_count += 1
|
self.offline_count += 1
|
||||||
tmpdb = tmpdir.join("offlinedb%d" % self.offline_count)
|
tmpdb = tmpdir.join("offlinedb%d" % self.offline_count)
|
||||||
ac = self.make_account(tmpdb.strpath, logid="ac{}".format(self.offline_count))
|
ac = self.make_account(tmpdb.strpath, logid="ac{}".format(self.offline_count))
|
||||||
ac._evtracker.init_time = self.init_time
|
|
||||||
ac._evtracker.set_timeout(2)
|
ac._evtracker.set_timeout(2)
|
||||||
return ac
|
return ac
|
||||||
|
|
||||||
|
|||||||
@@ -1575,6 +1575,8 @@ class TestOnlineAccount:
|
|||||||
|
|
||||||
def test_ephemeral_timer(self, acfactory, lp):
|
def test_ephemeral_timer(self, acfactory, lp):
|
||||||
ac1, ac2 = acfactory.get_two_online_accounts()
|
ac1, ac2 = acfactory.get_two_online_accounts()
|
||||||
|
ac1.set_config("e2ee_enabled", "0")
|
||||||
|
ac2.set_config("e2ee_enabled", "0")
|
||||||
|
|
||||||
lp.sec("ac1: create chat with ac2")
|
lp.sec("ac1: create chat with ac2")
|
||||||
chat1 = ac1.create_chat(ac2)
|
chat1 = ac1.create_chat(ac2)
|
||||||
|
|||||||
@@ -978,7 +978,7 @@ async fn perform_job_action(
|
|||||||
|
|
||||||
info!(
|
info!(
|
||||||
context,
|
context,
|
||||||
"Inbox finished immediate try {} of job {}", tries, job
|
"Finished immediate try {} of job {}", tries, job
|
||||||
);
|
);
|
||||||
|
|
||||||
try_res
|
try_res
|
||||||
|
|||||||
Reference in New Issue
Block a user