The blocking variant is for synchronous DataFusion FFI callbacks such as CatalogProvider::schema(), where we cannot `.await` directly.
(future: F, panic_error: &'static str)
| 59 | // The blocking variant is for synchronous DataFusion FFI callbacks such as |
| 60 | // CatalogProvider::schema(), where we cannot `.await` directly. |
| 61 | pub(crate) fn block_on_with_runtime<F>(future: F, panic_error: &'static str) -> F::Output |
| 62 | where |
| 63 | F: Future + Send + 'static, |
| 64 | F::Output: Send + 'static, |
| 65 | { |
| 66 | if Handle::try_current().is_ok() { |
| 67 | let handle = global_runtime().handle().clone(); |
| 68 | std::thread::spawn(move || handle.block_on(future)) |
| 69 | .join() |
| 70 | .expect(panic_error) |
| 71 | } else { |
| 72 | global_runtime().block_on(future) |
| 73 | } |
| 74 | } |
no test coverage detected