Use blocking reqwest API in defer

defer, or, trait functions such as it in general(?) cannot be async (yet)
This commit is contained in:
Igor Galić
2020-01-29 13:08:20 +01:00
parent 25c5da1a7c
commit a3f165f9f4
4 changed files with 12 additions and 3 deletions
+2 -1
View File
@@ -279,7 +279,8 @@ pub trait FromId<C>: Sized {
/// Dereferences an ID
fn deref(id: &str) -> Result<Self::Object, (Option<serde_json::Value>, Self::Error)> {
reqwest::ClientBuilder::new()
// Use blocking reqwest API here, since defer cannot be async (yet)
reqwest::blocking::Client::builder()
.connect_timeout(std::time::Duration::from_secs(5))
.build()
.map_err(|_| (None, InboxError::DerefError.into()))?