Run a function in an asyncio loop unconditionally. This function is used for provisioning features like testing a database connection for server info. Note that for blocking IO database drivers, this means they block the event loop.
(fn, *args, **kwargs)
| 35 | |
| 36 | |
| 37 | def _assume_async(fn, *args, **kwargs): |
| 38 | """Run a function in an asyncio loop unconditionally. |
| 39 | |
| 40 | This function is used for provisioning features like |
| 41 | testing a database connection for server info. |
| 42 | |
| 43 | Note that for blocking IO database drivers, this means they block the |
| 44 | event loop. |
| 45 | |
| 46 | """ |
| 47 | |
| 48 | if not ENABLE_ASYNCIO: |
| 49 | return fn(*args, **kwargs) |
| 50 | |
| 51 | return _async_util.run_in_greenlet(fn, *args, **kwargs) |
| 52 | |
| 53 | |
| 54 | def _maybe_async_provisioning(fn, *args, **kwargs): |
nothing calls this directly
no test coverage detected