Fix reporting of error back to HTTP client

This commit is contained in:
Michael Hansen 2022-05-09 20:26:06 -04:00
commit 9a8e34c839
3 changed files with 46 additions and 3 deletions

View file

@ -1,4 +1,18 @@
#!/usr/bin/env python3
# Copyright 2022 Mycroft AI Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import argparse
import asyncio
import io
@ -117,7 +131,7 @@ def do_synthesis_proc(args: argparse.Namespace, request_queue: Queue):
_LOGGER.exception("Error during inference")
# Signal error on main loop
asyncio.get_event_loop().call_soon_threadsafe(
item.loop.call_soon_threadsafe(
item.future.set_exception, e
)