From 0d57a887ea59b6111d9a19b1ea1cea619ad9f129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milien=20Devos?= Date: Wed, 14 Jul 2021 17:59:33 +0200 Subject: [PATCH] Mute unbuffered_flush IOError exception (#2235) Related to #1416, it doesn't really fix the real error, but instead mutes the exception message. Like explained in #1416, this "exception Error" while flushing the client data doesn't harm the client-server connection. However, this exception message continuously spams the logs and makes debugging and error finding really difficult. --- src/invidious/helpers/helpers.cr | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr index 072bdf952..d332ad378 100644 --- a/src/invidious/helpers/helpers.cr +++ b/src/invidious/helpers/helpers.cr @@ -700,6 +700,16 @@ def proxy_file(response, env) end end +class HTTP::Server::Response + class Output + private def unbuffered_flush + @io.flush + rescue ex : IO::Error + unbuffered_close + end + end +end + class HTTP::Client::Response def pipe(io) HTTP.serialize_body(io, headers, @body, @body_io, @version)