From 8d1e22383f7a7d9a9b9990874d1a27ed218a87ab Mon Sep 17 00:00:00 2001 From: "Mahlon E. Smith" Date: Mon, 19 Nov 2018 12:05:47 -0800 Subject: [PATCH] Fix command line usage docs, replace deprecated recvLine() with readLine(). --- netdata_tsrelay.nim | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/netdata_tsrelay.nim b/netdata_tsrelay.nim index c26ece5..3195f78 100644 --- a/netdata_tsrelay.nim +++ b/netdata_tsrelay.nim @@ -46,7 +46,7 @@ import const VERSION = "v0.2.0" USAGE = """ -./netdata_tsrelay [-q][-v][-h] --dbopts="[PostgreSQL connection string]" --listen-port=14866 --listen-addr=0.0.0.0 +./netdata_tsrelay [-d][-h][-q][-t][-T][-v] --dbopts="[PostgreSQL connection string]" --listen-port=14866 --listen-addr=0.0.0.0 -q: Quiet mode. No output at all. Ignored if -d is supplied. -d: Debug: Show incoming and parsed data. @@ -94,15 +94,13 @@ proc hl( msg: string, fg: ForegroundColor, bright=false ): string = proc fetch_data( client: Socket ): string = ## Netdata JSON backend doesn't send a length, so we read line by ## line and wait for stream timeout to determine a "sample". - var buf: string = "" + var buf = "" try: - result = client.recv_line( timeout=conf.timeout ) - if result != "": result = result & "\n" - while buf != "": - buf = client.recv_line( timeout=conf.timeout ) + while true: + client.readline( buf, timeout=conf.timeout ) if buf != "": result = result & buf & "\n" except TimeoutError: - discard + return proc parse_data( data: string ): seq[ JsonNode ] =