From 522280d6beea0a2ef1bf408a70c4d8259b49e17d Mon Sep 17 00:00:00 2001 From: Jarrod Johnon Date: Tue, 28 Oct 2014 16:45:55 -0400 Subject: [PATCH] Fix numerous issues with recent enhancements The buffer age was not working as intended The fix to exit on error exited overly eagerly The log replay failed to report a third value if file did not exist. --- confluent_client/bin/confetty | 4 ++-- confluent_server/confluent/consoleserver.py | 2 +- confluent_server/confluent/log.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/confluent_client/bin/confetty b/confluent_client/bin/confetty index 9f890888..19ac76af 100755 --- a/confluent_client/bin/confetty +++ b/confluent_client/bin/confetty @@ -85,7 +85,7 @@ def updatestatus(stateinfo={}): info.append(laststate['error']) if 'clientcount' in laststate and laststate['clientcount'] != 1: info.append('clients: %d' % laststate['clientcount']) - if 'bufferage' in stateinfo: + if 'bufferage' in stateinfo and stateinfo['bufferage'] is not None: laststate['showtime'] = time.time() - stateinfo['bufferage'] if 'showtime' in laststate: showtime = laststate['showtime'] @@ -561,7 +561,7 @@ elif shellargs: command = " ".join(shellargs) do_command(command, netserver) quitconfetty(fullexit=True) -while not doexit: +while inconsole or not doexit: if inconsole: rdylist, _, _ = select.select( (sys.stdin, session.connection), (), (), 60) diff --git a/confluent_server/confluent/consoleserver.py b/confluent_server/confluent/consoleserver.py index 6a87e6a6..ea4a93be 100644 --- a/confluent_server/confluent/consoleserver.py +++ b/confluent_server/confluent/consoleserver.py @@ -479,7 +479,7 @@ class ConsoleSession(object): """Get the age in seconds of the buffered data Returns False if no data buffered yet""" - self.conshdl.get_buffer_age() + return self.conshdl.get_buffer_age() def reopen(self): self.conshdl.reopen() diff --git a/confluent_server/confluent/log.py b/confluent_server/confluent/log.py index 90c11235..ea87c291 100644 --- a/confluent_server/confluent/log.py +++ b/confluent_server/confluent/log.py @@ -189,7 +189,7 @@ class Logger(object): textfile = open(self.textpath, mode='r') binfile = open(self.binpath, mode='r') except IOError: - return '', 0 + return '', 0, 0 fcntl.flock(binfile, fcntl.LOCK_SH) binfile.seek(0, 2) binidx = binfile.tell() - 16