flush the pending queue before returning
tokio's File buffers; an append that returned Ok could still be in memory when the next take() read the file. Caught by multiple_appends_accumulate on a runner, never on a developer machine.
This commit is contained in:
parent
12235cfdf1
commit
219590a89c
1 changed files with 5 additions and 0 deletions
|
|
@ -66,6 +66,11 @@ pub async fn append(agent_data_dir: &Path, items: &[PendingSurfacing]) -> anyhow
|
||||||
buf.push('\n');
|
buf.push('\n');
|
||||||
}
|
}
|
||||||
file.write_all(buf.as_bytes()).await?;
|
file.write_all(buf.as_bytes()).await?;
|
||||||
|
// tokio's File buffers. Without this the bytes can still be in memory when
|
||||||
|
// the next take() reads the file, and an append that returned Ok is simply
|
||||||
|
// absent -- which is what multiple_appends_accumulate caught on a runner
|
||||||
|
// and never caught on a developer machine.
|
||||||
|
file.flush().await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue