def clean_old_pages(self): # pragma: no cover self.context.log.debug('Cleaning old pages...') t = time.time() d = [] for k, v in self.pages.items(): if v.time + self.expiration_delay > t: d.append(k) for k in d: page = self.pages[k] page.close() yield from asyncio.sleep(60, loop=self.context.loop) yield from self.clean_old_pages()
def execute(self, bot): yield from asyncio.sleep(self.time, loop=bot.loop)