Skip to content

Commit

Permalink
hotfix/avoid_c++_crash (#76)
Browse files Browse the repository at this point in the history
partially mitigates OVOSHatchery/ovos-bus-server#2

not a proper fix, but makes it more usable, at least in buildroot it seems functional

low impact in latency since these scripts are not meant to be real time, they start a new bus connection etc and are already slow
  • Loading branch information
JarbasAl authored Jan 9, 2024
1 parent bad51fa commit 9bc9ae8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ovos_bus_client/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from ovos_bus_client import MessageBusClient, Message
from ovos_config import Configuration
import sys
import time


def ovos_speak():
Expand All @@ -22,6 +23,7 @@ def ovos_speak():
if not client.connected_event.is_set():
client.connected_event.wait()
client.emit(Message("speak", {"utterance": utt, "lang": lang}))
time.sleep(0.5) # avoids crash in c++ bus server
client.close()


Expand All @@ -41,6 +43,7 @@ def ovos_say_to():
if not client.connected_event.is_set():
client.connected_event.wait()
client.emit(Message("recognizer_loop:utterance", {"utterances": [utt], "lang": lang}))
time.sleep(0.5) # avoids crash in c++ bus server
client.close()


Expand All @@ -50,6 +53,7 @@ def ovos_listen():
if not client.connected_event.is_set():
client.connected_event.wait()
client.emit(Message("mycroft.mic.listen"))
time.sleep(0.5) # avoids crash in c++ bus server
client.close()


Expand Down Expand Up @@ -80,11 +84,12 @@ def simple_cli():
client.emit(Message("recognizer_loop:utterance",
{"utterances": [utt], "lang": lang},
{"session": sess.serialize()}))
time.sleep(0.5) # avoids crash in c++ bus server
except KeyboardInterrupt:
break

client.close()


if __name__ == "__main__":
simple_cli()
simple_cli()

0 comments on commit 9bc9ae8

Please sign in to comment.