This commit is contained in:
Bryan Stitt 2022-04-24 22:12:31 +00:00
parent 6f1d367776
commit daf6bed23a

View File

@ -211,15 +211,17 @@ impl Web3ProxyState {
let client = self.client.clone(); let client = self.client.clone();
let json_body = json_body.clone(); let json_body = json_body.clone();
tokio::spawn(async move { tokio::spawn(async move {
// TODO: there has to be a better way to do this map. i think maybe put the map outside this spawn? // TODO: there has to be a better way to do this map and map_err
let resp = client client
.post(&url) .post(&url)
.json(&json_body) .json(&json_body)
.send() .send()
.await .await
.map_err(|e| (url.clone(), e))?; // add the url to the error so that we can decrement
resp.text() .map_err(|e| (url.clone(), e))?
.text()
.await .await
// add the url to the result and the error so that we can decrement
.map(|t| (url.clone(), t)) .map(|t| (url.clone(), t))
.map_err(|e| (url, e)) .map_err(|e| (url, e))
}) })