diff --git a/Flask/app.py b/Flask/app.py index f2df2f0..a706de9 100644 --- a/Flask/app.py +++ b/Flask/app.py @@ -20,13 +20,11 @@ pubsub = redis_client.pubsub() pubsub.subscribe('console') def generate_output(): - while 1 : - try: - for message in pubsub.listen(): - if message['type'] == 'message': - yield f"data: {message['data'].decode()}\n\n" - except redis.exceptions.ConnectionError as e: - print(f"Error connecting to Redis: {e}") + for message in pubsub.listen(): + if message['type'] == 'message': + print(message) + yield f"data: {message['data'].decode()}\n\n" + # the end