Fixes a race condition with multiple simultaneous get requests. (#1807)

* Fixes a race condition with multiple simultaneous get requests.

* Removed unused import

* Removed unused threading import

* Changed lock style to notation

* make style

Co-authored-by: WeberJulian <julian.weber@hotmail.fr>
This commit is contained in:
KyuubiYoru 2022-09-08 10:16:16 +02:00 committed by GitHub
parent bb59718c03
commit 3b7dff568a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 9 deletions

View File

@ -5,6 +5,7 @@ import json
import os
import sys
from pathlib import Path
from threading import Lock
from typing import Union
from flask import Flask, render_template, request, send_file
@ -168,8 +169,12 @@ def details():
)
lock = Lock()
@app.route("/api/tts", methods=["GET"])
def tts():
with lock:
text = request.args.get("text")
speaker_idx = request.args.get("speaker_id", "")
style_wav = request.args.get("style_wav", "")