Use blocking reqwest API in defer
defer, or, trait functions such as it in general(?) cannot be async (yet)
This commit is contained in:
parent
25c5da1a7c
commit
a3f165f9f4
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -3180,6 +3180,7 @@ dependencies = [
|
|||||||
"percent-encoding 2.1.0",
|
"percent-encoding 2.1.0",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_json",
|
||||||
"serde_urlencoded 0.6.1",
|
"serde_urlencoded 0.6.1",
|
||||||
"time",
|
"time",
|
||||||
"tokio 0.2.20",
|
"tokio 0.2.20",
|
||||||
|
@ -16,7 +16,6 @@ hex = "0.3"
|
|||||||
hyper = "0.13"
|
hyper = "0.13"
|
||||||
openssl = "0.10.22"
|
openssl = "0.10.22"
|
||||||
rocket = { git = "https://github.com/SergioBenitez/Rocket", rev = "async" }
|
rocket = { git = "https://github.com/SergioBenitez/Rocket", rev = "async" }
|
||||||
reqwest = "0.10"
|
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
@ -32,3 +31,7 @@ version = "0.4"
|
|||||||
[dependencies.pulldown-cmark]
|
[dependencies.pulldown-cmark]
|
||||||
default-features = false
|
default-features = false
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
|
||||||
|
[dependencies.reqwest]
|
||||||
|
features = ["json", "blocking"]
|
||||||
|
version = "0.10"
|
||||||
|
@ -279,7 +279,8 @@ pub trait FromId<C>: Sized {
|
|||||||
|
|
||||||
/// Dereferences an ID
|
/// Dereferences an ID
|
||||||
fn deref(id: &str) -> Result<Self::Object, (Option<serde_json::Value>, Self::Error)> {
|
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))
|
.connect_timeout(std::time::Duration::from_secs(5))
|
||||||
.build()
|
.build()
|
||||||
.map_err(|_| (None, InboxError::DerefError.into()))?
|
.map_err(|_| (None, InboxError::DerefError.into()))?
|
||||||
|
@ -16,7 +16,6 @@ lazy_static = "1.0"
|
|||||||
migrations_internals= "1.4.0"
|
migrations_internals= "1.4.0"
|
||||||
openssl = "0.10.22"
|
openssl = "0.10.22"
|
||||||
rocket = { git = "https://github.com/SergioBenitez/Rocket", rev = "async" }
|
rocket = { git = "https://github.com/SergioBenitez/Rocket", rev = "async" }
|
||||||
reqwest = "0.10"
|
|
||||||
scheduled-thread-pool = "0.2.2"
|
scheduled-thread-pool = "0.2.2"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
@ -47,6 +46,11 @@ path = "../plume-common"
|
|||||||
[dependencies.plume-macro]
|
[dependencies.plume-macro]
|
||||||
path = "../plume-macro"
|
path = "../plume-macro"
|
||||||
|
|
||||||
|
[dependencies.reqwest]
|
||||||
|
features = ["json", "blocking"]
|
||||||
|
version = "0.10"
|
||||||
|
|
||||||
|
|
||||||
[dependencies.rocket_i18n]
|
[dependencies.rocket_i18n]
|
||||||
git = "https://github.com/Plume-org/rocket_i18n"
|
git = "https://github.com/Plume-org/rocket_i18n"
|
||||||
branch = "go-async"
|
branch = "go-async"
|
||||||
|
Loading…
Reference in New Issue
Block a user