Cleanup write_entries

This commit is contained in:
Greg Fitzgerald 2018-07-01 08:13:00 -07:00 committed by Greg Fitzgerald
parent 1f9494221b
commit adcaf715c6
1 changed files with 3 additions and 4 deletions

View File

@ -50,15 +50,14 @@ impl<'a> EntryWriter<'a> {
entry_receiver: &Receiver<Entry>,
) -> Result<Vec<Entry>> {
//TODO implement a serialize for channel that does this without allocations
let mut l = vec![];
let entry = entry_receiver.recv_timeout(Duration::new(1, 0))?;
self.write_and_register_entry(writer, &entry)?;
l.push(entry);
let mut entries = vec![entry];
while let Ok(entry) = entry_receiver.try_recv() {
self.write_and_register_entry(writer, &entry)?;
l.push(entry);
entries.push(entry);
}
Ok(l)
Ok(entries)
}
/// Process any Entry items that have been published by the Historian.