Fix API proxy reliabilty by making flask single threaded.
This commit is contained in:
parent
f42a3147df
commit
fcb554bf5b
2 changed files with 8 additions and 2 deletions
|
@ -94,16 +94,20 @@ class MyRadioAPI:
|
||||||
|
|
||||||
if not payload["current"]:
|
if not payload["current"]:
|
||||||
self._logException("API did not return a current show.")
|
self._logException("API did not return a current show.")
|
||||||
return []
|
|
||||||
|
|
||||||
if not payload["next"]:
|
if not payload["next"]:
|
||||||
self._logException("API did not return a list of next shows.")
|
self._logException("API did not return a list of next shows.")
|
||||||
return []
|
|
||||||
|
|
||||||
shows = []
|
shows = []
|
||||||
shows.append(payload["current"])
|
shows.append(payload["current"])
|
||||||
shows.extend(payload["next"])
|
shows.extend(payload["next"])
|
||||||
|
|
||||||
|
timeslots = []
|
||||||
|
# Remove jukebox etc
|
||||||
|
for show in shows:
|
||||||
|
if not "timeslot_id" in show:
|
||||||
|
shows.remove(show)
|
||||||
|
|
||||||
# TODO filter out jukebox
|
# TODO filter out jukebox
|
||||||
return shows
|
return shows
|
||||||
|
|
||||||
|
|
|
@ -312,6 +312,7 @@ def channel_json(channel: int):
|
||||||
|
|
||||||
@app.route("/plan/list")
|
@app.route("/plan/list")
|
||||||
def list_showplans():
|
def list_showplans():
|
||||||
|
|
||||||
while not api_from_q.empty():
|
while not api_from_q.empty():
|
||||||
api_from_q.get() # Just waste any previous status responses.
|
api_from_q.get() # Just waste any previous status responses.
|
||||||
|
|
||||||
|
@ -620,6 +621,7 @@ def startServer():
|
||||||
port=state.state["port"],
|
port=state.state["port"],
|
||||||
debug=True,
|
debug=True,
|
||||||
use_reloader=False,
|
use_reloader=False,
|
||||||
|
threaded=False # While API handles are singlethreaded.
|
||||||
)
|
)
|
||||||
|
|
||||||
global webserver
|
global webserver
|
||||||
|
|
Loading…
Reference in a new issue