use BufWritter to save the cache

This commit is contained in:
Boog900 2023-10-26 13:14:43 +01:00
parent 65378b0523
commit d0bd17c560
No known key found for this signature in database
GPG key ID: 5401367FB7302004
2 changed files with 5 additions and 2 deletions

View file

@ -1,7 +1,9 @@
use std::io::Write;
use std::{
collections::HashMap,
collections::HashSet,
fmt::{Display, Formatter},
io::BufWriter,
path::Path,
sync::Arc,
};
@ -35,8 +37,9 @@ impl ScanningCache {
.truncate(true)
.create(true)
.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())?;
writer.flush()?;
Ok(())
}

View file

@ -7,7 +7,7 @@ use std::{
use futures::{
channel::mpsc::{self, SendError},
stream::FuturesUnordered,
SinkExt,
SinkExt, StreamExt,
};
use monero_serai::rpc::HttpRpc;
use tokio::time::timeout;