From 68c73fa18157e9a4711d7f2049f9fcce24dad6db Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 28 Oct 2023 16:47:31 +0200 Subject: [PATCH] [`tts.mimic3`] Added timeout to `requests.post` proxy. --- platypush/backend/http/app/routes/plugins/tts/mimic3.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platypush/backend/http/app/routes/plugins/tts/mimic3.py b/platypush/backend/http/app/routes/plugins/tts/mimic3.py index 8bf37f6d4..7d033b0ac 100644 --- a/platypush/backend/http/app/routes/plugins/tts/mimic3.py +++ b/platypush/backend/http/app/routes/plugins/tts/mimic3.py @@ -5,6 +5,8 @@ from flask import abort, request, Blueprint from platypush.backend.http.app import template_folder +# Upstream /api/tts response timeout, in seconds +_default_timeout = 30 mimic3 = Blueprint('mimic3', __name__, template_folder=template_folder) # Declare routes list @@ -35,6 +37,7 @@ def proxy_tts_request(): rs = requests.post( urljoin(args['server_url'], '/api/tts'), data=args['text'], + timeout=int(request.args.get('timeout', _default_timeout)), params={ 'voice': args['voice'], },