(self)
Maintain the pool of workers while open.

        :meta private:
Maintain the pool of workers while open.
Maintain the pool of workers while open .
async def loop(self) -> None:
        """
        Maintain the pool of workers while open.

        :meta private:
        """
        while self.processes or self.running:
            # clean up workers that reached TTL
            for process in list(self.processes):
                if not process.is_alive():
                    qid = self.processes.pop(process)
                    if self.running:
                        self.processes[self.create_worker(qid)] = qid

            # pull results into a shared dictionary for later retrieval
            for _, rx in self.queues.values():
                while True:
                    try:
                        task_id, value, tb = rx.get_nowait()
                        self.finish_work(task_id, value, tb)

                    except queue.Empty:
                        break

            # let someone else do some work for once
            await asyncio.sleep(0.005)
async def loop ( self ) -> None : while self . processes or self . running : # clean up workers that reached TTL for process in list ( self . processes ) : if not process . is_alive ( ) : qid = self . processes . pop ( process ) if self . running : self . processes [ self . create_worker ( qid ) ] = qid # pull results into a shared dictionary for later retrieval for _ , rx in self . queues . values ( ) : while True : try : task_id , value , tb = rx . get_nowait ( ) self . finish_work ( task_id , value , tb ) except queue . Empty : break # let someone else do some work for once await asyncio . sleep ( 0.005 )