From 33c9a20c343638f932fd8aa53edca1974b7e21cd Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Fri, 25 Oct 2019 15:58:54 +0200 Subject: [PATCH] Fix slow (unbuffered) readline. --- src/check_hls/lib/nagios/plugins/check_hls | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/check_hls/lib/nagios/plugins/check_hls b/src/check_hls/lib/nagios/plugins/check_hls index d291587..53bd1b9 100644 --- a/src/check_hls/lib/nagios/plugins/check_hls +++ b/src/check_hls/lib/nagios/plugins/check_hls @@ -363,8 +363,11 @@ class CheckHls(): segment_urls = [] total_duration = 0.0 metadata = {} - for line in iter(res.readline, b""): - line = line.decode("utf-8").strip() + result = res.read().decode("utf-8") + for line in result.split("\n"): + line = line.strip() + if len(line) == 0: + continue #print(line) if line[0] == "#": header, value = self.parse_metaline(line)