mirror of
https://git.deuxfleurs.fr/Deuxfleurs/garage.git
synced 2024-11-25 09:31:00 +00:00
Resync block on read error
This commit is contained in:
parent
b780f6485d
commit
4bacaaf53f
1 changed files with 8 additions and 1 deletions
|
@ -77,7 +77,14 @@ impl BlockManager {
|
||||||
let mut path = self.block_dir(hash);
|
let mut path = self.block_dir(hash);
|
||||||
path.push(hex::encode(hash));
|
path.push(hex::encode(hash));
|
||||||
|
|
||||||
let mut f = fs::File::open(&path).await?;
|
let mut f = match fs::File::open(&path).await {
|
||||||
|
Ok(f) => f,
|
||||||
|
Err(e) => {
|
||||||
|
// Not found but maybe we should have had it ??
|
||||||
|
self.put_to_resync(hash, DEFAULT_TIMEOUT.as_millis() as u64)?;
|
||||||
|
return Err(Into::into(e));
|
||||||
|
}
|
||||||
|
};
|
||||||
let mut data = vec![];
|
let mut data = vec![];
|
||||||
f.read_to_end(&mut data).await?;
|
f.read_to_end(&mut data).await?;
|
||||||
drop(f);
|
drop(f);
|
||||||
|
|
Loading…
Reference in a new issue