diff --git a/graphite_api/finders/whisper.py b/graphite_api/finders/whisper.py index e643006..feffa21 100644 --- a/graphite_api/finders/whisper.py +++ b/graphite_api/finders/whisper.py @@ -122,6 +122,9 @@ def fetch(self, startTime, endTime): # noqa if isinstance(cached_datapoints, dict): cached_datapoints = cached_datapoints.items() for timestamp, value in sorted(cached_datapoints): + # filter only to cached datapoints within [start, end) + if not (timestamp >= start and timestamp < end): + continue interval = timestamp - (timestamp % step) i = int(interval - start) // step values[i] = value @@ -133,7 +136,7 @@ class GzippedWhisperReader(WhisperReader): def get_intervals(self): fh = gzip.GzipFile(self.fs_path, 'rb') try: - info = whisper.__readHeader(fh) # evil, but necessary. + info = getattr(whisper, '__readHeader')(fh) # evil, but necessary. finally: fh.close()