def on_modified(self, event): res_file = event.src_path save_offset = 0 line_matches = 0 for line, offset in offset_file(res_file, offset=self.offset): if re.search("Finished", line): line_matches += 1 if re.search("End", line): DB.compete_mesh_step(mesh_id=self.mesh_id) return save_offset = offset self.current_step += line_matches self.offset = save_offset if save_offset > 0 else self.offset res = DB.query_mesh_status(self.mesh_id) if res == {}: convert_logger.critical(f"mesh_status中没有对应的mesh | {self.mesh_id}") return else: DB.update_mesh_status(self.mesh_id, current_step=self.current_step)