Skip to content
Myr

Introduce maximum output buffer size (#212)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Closes #191

authored by David Peter · committed by GitHub · parent 39fb41f · Browse files · 2 files+8 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+8 added−3 removed

  • other:+8 added−3 removed

2 files+8 added−3 removed

modified:src/internal.rs+3 added
99 unmodified lines
100 _ => false,101 }102}103104/// Maximum size of the output buffer before flushing results to the console105pub const MAX_BUFFER_LENGTH: usize = 1000;106107/// Exit code representing a general error108pub const EXITCODE_ERROR: i32 = 1;109110/// Exit code representing that the process was killed by SIGINT
1 unmodified line
modified:src/walk.rs+5 added-3 removed
8 unmodified lines
9extern crate ctrlc;1011use exec;12use fshelper;13use internal::{error, FdOptions, EXITCODE_SIGINT};13use internal::{error, FdOptions, EXITCODE_SIGINT, MAX_BUFFER_LENGTH};14use output;1516use std::process;17use std::path::PathBuf;
128 unmodified lines
146 match mode {147 ReceiverMode::Buffering => {148 buffer.push(value);149150 // Have we reached the maximum time?151 if time::Instant::now() - start > max_buffer_time {150 // Have we reached the maximum buffer size or maximum buffering time?151 if buffer.len() > MAX_BUFFER_LENGTH152 || time::Instant::now() - start > max_buffer_time153 {154 // Flush the buffer155 for v in &buffer {156 output::print_entry(v, &rx_config, &receiver_wtq);157 }
98 unmodified lines