+ def compress(self, timedelta):
+ now = datetime.datetime.now()
+ oldNumConvs = len(self._conversations)
+ oldConvs = self._conversations
+ self._conversations = [
+ conv
+ for conv in self._conversations
+ if (now - conv.time) < timedelta
+ ]
+ newNumConvs = len(self._conversations)
+ if oldNumConvs != newNumConvs:
+ _moduleLogger.debug("Compressed conversations from %s to %s" % (oldNumConvs, newNumConvs))
+ else:
+ _moduleLogger.debug("Did not compress, %s" % (newNumConvs))
+