Skip to content

Commit 047056f

Browse files
committed
Reorganize writer for recording
1 parent 72872f6 commit 047056f

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/commands/run.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,19 @@ pub mod rr_impl {
140140
store.record(io::sink(), settings)?;
141141
} else {
142142
let buffer_capacity = record.buffer_size.unwrap_or(8 * 1024); // Default to 8 KiB buffer
143-
let file = io::BufWriter::with_capacity(buffer_capacity, fs::File::create(&path)?);
143+
let file = fs::File::create(&path)?;
144144
if record.threaded.unwrap_or(false) {
145-
let config = ThreadedWriterConfig {
146-
buffer_capacity,
147-
channels: record.channels.unwrap_or(8),
148-
};
149-
let writer = ThreadedWriter::new(Box::new(file), config);
145+
let writer = ThreadedWriter::new(
146+
Box::new(file),
147+
ThreadedWriterConfig {
148+
buffer_capacity,
149+
channels: record.channels.unwrap_or(8),
150+
},
151+
);
150152
store.record(writer, settings)?;
151153
} else {
152-
store.record(file, settings)?;
154+
let writer = io::BufWriter::with_capacity(buffer_capacity, file);
155+
store.record(writer, settings)?;
153156
}
154157
}
155158
}

0 commit comments

Comments
 (0)