Shutdown all active asynchronous generators.
(self)
| 573 | self._asyncgens.add(agen) |
| 574 | |
| 575 | async def shutdown_asyncgens(self): |
| 576 | """Shutdown all active asynchronous generators.""" |
| 577 | self._asyncgens_shutdown_called = True |
| 578 | |
| 579 | if not len(self._asyncgens): |
| 580 | # If Python version is <3.6 or we don't have any asynchronous |
| 581 | # generators alive. |
| 582 | return |
| 583 | |
| 584 | closing_agens = list(self._asyncgens) |
| 585 | self._asyncgens.clear() |
| 586 | |
| 587 | results = await tasks.gather( |
| 588 | *[ag.aclose() for ag in closing_agens], |
| 589 | return_exceptions=True) |
| 590 | |
| 591 | for result, agen in zip(results, closing_agens): |
| 592 | if isinstance(result, Exception): |
| 593 | self.call_exception_handler({ |
| 594 | 'message': f'an error occurred during closing of ' |
| 595 | f'asynchronous generator {agen!r}', |
| 596 | 'exception': result, |
| 597 | 'asyncgen': agen |
| 598 | }) |
| 599 | |
| 600 | async def shutdown_default_executor(self, timeout=None): |
| 601 | """Schedule the shutdown of the default executor. |
nothing calls this directly
no test coverage detected