| 547 | self.engine_debug(f"{self.name}: finished worker()") |
| 548 | |
| 549 | async def _shutdown(self): |
| 550 | if not self._shutdown_status: |
| 551 | self.log.verbose(f"{self.name}: shutting down...") |
| 552 | self._shutdown_status = True |
| 553 | await self.cancel_all_tasks() |
| 554 | context = getattr(self, "context", None) |
| 555 | if context is not None: |
| 556 | try: |
| 557 | context.destroy(linger=0) |
| 558 | except Exception: |
| 559 | self.log.trace(traceback.format_exc()) |
| 560 | try: |
| 561 | context.term() |
| 562 | except Exception: |
| 563 | self.log.trace(traceback.format_exc()) |
| 564 | self.log.verbose(f"{self.name}: finished shutting down") |
| 565 | |
| 566 | async def task_pool(self, fn, args_kwargs, threads=10, timeout=300, global_kwargs=None): |
| 567 | if global_kwargs is None: |