rework the login timer loop.

patch bump
This commit is contained in:
onyx-and-iris 2023-10-27 23:21:40 +01:00
parent b360545aa6
commit 54dfa372b1
2 changed files with 10 additions and 7 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "voicemeeter-api"
version = "2.5.0"
version = "2.5.1"
description = "A Python wrapper for the Voiceemeter API"
authors = ["onyx-and-iris <code@onyxandiris.online>"]
license = "MIT"

View File

@ -75,20 +75,23 @@ class Remote(CBindings):
"Voicemeeter engine running but GUI not launched. Launching the GUI now."
)
self.run_voicemeeter(self.kind.name)
err = None
start = time.time()
while True:
while time.time() < start + self.timeout:
try:
time.sleep(0.1) # ensure at least 0.1 delay before clearing dirty
self.logger.info(
f"{type(self).__name__}: Successfully logged into {self} version {self.version}"
)
elapsed = time.time() - start
self.logger.debug(f"login time: {round(elapsed, 2)}")
self.logger.debug(f"login time: {round(time.time() - start, 2)}")
err = None
break
except CAPIError:
if time.time() > start + self.timeout:
raise VMError("Timeout logging into the api")
except CAPIError as e:
err = e
continue
if err:
raise VMError("Timeout logging into the api")
self.clear_dirty()
def run_voicemeeter(self, kind_id: str) -> None: