Fix check for interval ends to be None, so that zero doesn't confuse it

This commit is contained in:
Jim Paris 2013-02-21 12:42:27 -05:00
parent db7211c3a9
commit 30e3ffc0e9

View File

@ -277,7 +277,7 @@ class StreamInserter(object):
# If starting a new block, pull out the timestamp if needed.
if self._block_start is None:
if self._interval_start:
if self._interval_start is not None:
# User provided a start timestamp. Use it once, then
# clear it for the next block.
self._block_start = self._interval_start
@ -328,7 +328,7 @@ class StreamInserter(object):
Use the timestamp from the next line, so that the blocks
are contiguous."""
block_end = extract_timestamp(self._line_new)
if self._interval_end and block_end > self._interval_end:
if self._interval_end is not None and block_end > self._interval_end:
# Something's fishy -- the timestamp we found is after
# the user's specified end. Limit it here, and the
# server will return an error.
@ -339,7 +339,7 @@ class StreamInserter(object):
"""Send data, when this is the last block for the interval.
There is no next line, so figure out the actual interval end
using interval_end or end_epsilon."""
if self._interval_end:
if self._interval_end is not None:
# Use the user's specified end timestamp
block_end = self._interval_end
# Clear it in case we send more intervals in the future.