From 5547d266d0bd936bda0383de965d6beace0bdba5 Mon Sep 17 00:00:00 2001 From: Jim Paris Date: Thu, 11 Apr 2013 11:53:17 -0400 Subject: [PATCH] filter: Don't include trailing unprocessed data in the inserted intervals --- src/filter.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/filter.py b/src/filter.py index 8c0a37e..b4ffba1 100644 --- a/src/filter.py +++ b/src/filter.py @@ -275,6 +275,10 @@ class Filter(object): Return value of 'function' is the number of data rows processed. Unprocessed data will be provided again in a subsequent call (unless 'final' is True). + + If unprocessed data remains after 'final' is True, the interval + being inserted will be ended at the timestamp of the first + unprocessed data point. """ if args is None: args = [] @@ -319,7 +323,13 @@ class Filter(object): # Last call for this contiguous interval if old_array.shape[0] != 0: - function(old_array, interval, args, insert_function, True) + processed = function(old_array, interval, args, + insert_function, True) + if processed != old_array.shape[0]: + # Truncate the interval we're inserting at the first + # unprocessed data point. This ensures that + # we'll not miss any data when we run again later. + insert_ctx.update_end(old_array[processed][0]) def main(argv = None): # This is just a dummy function; actual filters can use the other