Compare commits

...

3 Commits

Author SHA1 Message Date
missytake
d4979eade3 Update python/src/deltachat/tracker.py
Co-authored-by: Asiel Díaz Benítez <adbenitez@nauta.cu>
2021-09-26 22:55:47 +02:00
missytake
0724a08425 python-bindings: catch timeout 2021-09-26 22:29:04 +02:00
missytake
43730a2d8a python-bindings: set timeout for account configure
I need this for a script - it's not very important, it would just be nice to set a timeout if the account isn't configurable.
2021-09-26 22:01:27 +02:00

View File

@@ -1,5 +1,5 @@
from queue import Queue
from queue import Queue, Empty
from threading import Event
from .hookspec import account_hookimpl, Global
@@ -90,11 +90,16 @@ class ConfigureTracker:
if data1 is None or evdata == data1:
break
def wait_finish(self):
def wait_finish(self, timeout=None):
""" wait until configure is completed.
Raise Exception if Configure failed
:param timeout: how many seconds until configuring is given up.
:raises: ConfigureFailed if Configured failed or timeout reached.
"""
if not self._configure_events.get():
try:
if not self._configure_events.get(timeout=timeout):
content = "\n".join(map(str, self._ffi_events))
raise ConfigureFailed(content)
except Empty:
content = "\n".join(map(str, self._ffi_events))
raise ConfigureFailed(content)