Fix double-locking bug in flush()
This commit is contained in:
parent
34ec8966b2
commit
e0e68ce76d
|
@ -527,14 +527,20 @@ impl RawPile for SqliteBloblogPile {
|
||||||
Ok(Box::new(ki))
|
Ok(Box::new(ki))
|
||||||
}
|
}
|
||||||
fn flush(&self) -> anyhow::Result<()> {
|
fn flush(&self) -> anyhow::Result<()> {
|
||||||
let inner = self.inner.lock().unwrap();
|
// must do this before we lock inner.
|
||||||
let _inner = self
|
|
||||||
.writers_reach_zero
|
|
||||||
.wait_while(inner, |inner| inner.writers_in_progress != 0)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
self.flush_queued_pointer_writes()?;
|
self.flush_queued_pointer_writes()?;
|
||||||
|
|
||||||
|
let inner = self.inner.lock().unwrap();
|
||||||
|
|
||||||
|
if inner.writers_in_progress > 0 {
|
||||||
|
let _inner = self
|
||||||
|
.writers_reach_zero
|
||||||
|
.wait_while(inner, |inner| {
|
||||||
|
inner.writers_in_progress != 0
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO sync all files we have open first!
|
// TODO sync all files we have open first!
|
||||||
sync();
|
sync();
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in New Issue