def commit(self, restart=True):
if self.period:
self.timer.cancel()
with self.lock:
ramreader = self._get_ram_reader()
self._make_ram_index()
if self.bufferedcount:
self.writer.add_reader(ramreader)
self.writer.commit(**self.commitargs)
self.bufferedcount = 0
if restart:
self.writer = self.index.writer(**self.writerargs)
if self.period:
self.timer = threading.Timer(self.period, self.commit)
self.timer.start()
评论列表
文章目录