mirror of
https://github.com/Cuprate/cuprate.git
synced 2025-01-09 20:40:01 +00:00
use BufWritter to save the cache
This commit is contained in:
parent
65378b0523
commit
d0bd17c560
2 changed files with 5 additions and 2 deletions
|
@ -1,7 +1,9 @@
|
||||||
|
use std::io::Write;
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
collections::HashSet,
|
collections::HashSet,
|
||||||
fmt::{Display, Formatter},
|
fmt::{Display, Formatter},
|
||||||
|
io::BufWriter,
|
||||||
path::Path,
|
path::Path,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
|
@ -35,8 +37,9 @@ impl ScanningCache {
|
||||||
.truncate(true)
|
.truncate(true)
|
||||||
.create(true)
|
.create(true)
|
||||||
.open(file)?;
|
.open(file)?;
|
||||||
let mut writer = file.make_writer();
|
let mut writer = BufWriter::new(file.make_writer());
|
||||||
bincode::encode_into_std_write(self, &mut writer, bincode::config::standard())?;
|
bincode::encode_into_std_write(self, &mut writer, bincode::config::standard())?;
|
||||||
|
writer.flush()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::{
|
||||||
use futures::{
|
use futures::{
|
||||||
channel::mpsc::{self, SendError},
|
channel::mpsc::{self, SendError},
|
||||||
stream::FuturesUnordered,
|
stream::FuturesUnordered,
|
||||||
SinkExt,
|
SinkExt, StreamExt,
|
||||||
};
|
};
|
||||||
use monero_serai::rpc::HttpRpc;
|
use monero_serai::rpc::HttpRpc;
|
||||||
use tokio::time::timeout;
|
use tokio::time::timeout;
|
||||||
|
|
Loading…
Reference in a new issue