When XrpcClient's base_uri setter is called (at least on the OAuthSession implementation), tokio will panic when using the current_thread flavor with the error message can call blocking only when running on the multi-threaded runtime.
The snippet that causes the panic is:
fn base_uri(&self) -> Url {
// base_uri is a synchronous trait method; we must avoid async `.read().await`.
// Use `block_in_place` under Tokio runtime to perform a blocking RwLock read safely.
#[cfg(not(target_arch = "wasm32"))]
if tokio::runtime::Handle::try_current().is_ok() {
return tokio::task::block_in_place(|| self.data.blocking_read().host_url.clone());
}
self.data.blocking_read().host_url.clone()
}
This can be reproduced by implementing a basic OAuth flow as described in the docs and using #[tokio::main(flavor = "current_thread")]
good catch. i'm not happy with that bit of code. would you prefer i make the method async to match the underlying storage? the block was a stopgap i knew i would have to deal with eventually.