src/backup/catalog.rs - SenderWriter: use tokio::task::block_in_place
Make sure we do not block the executor.
This commit is contained in:
parent
94609e2380
commit
d2dd827877
|
@ -384,11 +384,13 @@ impl SenderWriter {
|
|||
|
||||
impl Write for SenderWriter {
|
||||
fn write(&mut self, buf: &[u8]) -> Result<usize, std::io::Error> {
|
||||
tokio::task::block_in_place(|| {
|
||||
futures::executor::block_on(async move {
|
||||
self.0.send(Ok(buf.to_vec())).await
|
||||
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err.to_string()))?;
|
||||
Ok(buf.len())
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> Result<(), std::io::Error> {
|
||||
|
|
Loading…
Reference in New Issue