From 35afd63714ee859107b29b7c8d8a21f847a2ed65 Mon Sep 17 00:00:00 2001 From: d10s <79284025+D10S0VSkY-OSS@users.noreply.github.com> Date: Wed, 29 Nov 2023 23:59:02 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7refactor:=20sse=20fine=20tunning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sld-dashboard/app/home/routes.py | 3 ++- sld-dashboard/gunicorn-cfg.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sld-dashboard/app/home/routes.py b/sld-dashboard/app/home/routes.py index b264a01e..b389afe9 100644 --- a/sld-dashboard/app/home/routes.py +++ b/sld-dashboard/app/home/routes.py @@ -57,9 +57,10 @@ def deploy_stream(task_id): @login_required def stream(task_id): def generate(): - pubsub = s.pubsub() + pubsub = s.pubsub(ignore_subscribe_messages=True) pubsub.subscribe(f'{task_id}') for message in pubsub.listen(): + logging.info(message) yield f"data: {message['data']}\n\n" return Response(generate(), mimetype='text/event-stream') diff --git a/sld-dashboard/gunicorn-cfg.py b/sld-dashboard/gunicorn-cfg.py index 54e9f4c8..3dedc362 100644 --- a/sld-dashboard/gunicorn-cfg.py +++ b/sld-dashboard/gunicorn-cfg.py @@ -5,6 +5,7 @@ bind = "0.0.0.0:5000" workers = 10 +threads = 100 accesslog = "-" loglevel = "info" capture_output = True