Sets maxlen

def set_maxlen(self, length):
        """Sets maxlen"""
        with self.lock:
            self._maxlen = length
            while len(self.data) > length:
                self._poplast()