Issue #16 new

Possible for _macro_aggregate to be called before any points have been stored

Anonymous created an issue

If (e.g. in testcode) a table is created, then it is > aggregation_interval before an entry is made it's possible for _macro_aggregate to be called with points being an empty list.

This causes the log to fail - as min([]) raises a value error.

def _macro_aggregate(self):
    """Perform aggregation every aggregation_interval"""
    # aggregate
        if len(points) > 0:
        points = self.current_point_list


        interval = (self.current_point_time - self.last_aggregation_time) / 60.0
        self.log.info("%s: interval=%s min=%s max=%s average=%s",
                   self.name,
                   round(interval),
                   min(points),
                   max(points),
                   average(points))

        #reset
        self.current_point_list = []
        self.last_aggregation_time = int(time())

Comments (1)

  1. Log in to comment