Await in consumer
This commit is contained in:
parent
ce4b216722
commit
f22c4d5c78
@ -173,26 +173,28 @@ where
|
|||||||
);
|
);
|
||||||
let client = client.clone();
|
let client = client.clone();
|
||||||
let tx = tx.clone();
|
let tx = tx.clone();
|
||||||
rt.spawn(async move {
|
let _ = tx.send(
|
||||||
let _ = tx.send(
|
rt.spawn(
|
||||||
client
|
client
|
||||||
.post(&inbox)
|
.post(&inbox)
|
||||||
.headers(headers.clone())
|
.headers(headers.clone())
|
||||||
.body(body)
|
.body(body)
|
||||||
.send()
|
.send(),
|
||||||
.await,
|
),
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
while let Some(request) = rx.recv().await {
|
while let Some(request) = rx.recv().await {
|
||||||
let _ = request
|
let _ = request
|
||||||
|
.await
|
||||||
.map(move |r| {
|
.map(move |r| {
|
||||||
if r.status().is_success() {
|
r.map(|r| {
|
||||||
debug!("Successfully sent activity to inbox ({})", &r.url());
|
if r.status().is_success() {
|
||||||
} else {
|
debug!("Successfully sent activity to inbox ({})", &r.url());
|
||||||
warn!("Error while sending to inbox ({} {:?})", &r.url(), &r)
|
} else {
|
||||||
}
|
warn!("Error while sending to inbox ({} {:?})", &r.url(), &r)
|
||||||
debug!("Response: \"{:?}\"\n", r);
|
}
|
||||||
|
debug!("Response: \"{:?}\"\n", r);
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.map_err(|e| warn!("Error while sending to inbox ({:?})", e));
|
.map_err(|e| warn!("Error while sending to inbox ({:?})", e));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user