diff options
author | Neal H. Walfield <neal@pep.foundation> | 2023-01-06 11:15:13 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2023-01-06 12:41:41 +0100 |
commit | 81c471292d3b15f48d236f8432aacf2b734f9d1e (patch) | |
tree | 5e71b870181624ac9669c5a227236dd7d52cb46e /buffered-reader/src/limitor.rs | |
parent | e83bf2fd83f5345307d2acf97a5000a8392f182b (diff) |
buffered-reader: Set the buffer size using an environment variable
- If the environment variable `SEQUOIA_BUFFERED_READER_BUFFER` is
set, and we are able to parse it as a usize, use it as the default
buffer size.
Diffstat (limited to 'buffered-reader/src/limitor.rs')
-rw-r--r-- | buffered-reader/src/limitor.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/buffered-reader/src/limitor.rs b/buffered-reader/src/limitor.rs index 54ac5a78..ebf8d6b7 100644 --- a/buffered-reader/src/limitor.rs +++ b/buffered-reader/src/limitor.rs @@ -242,7 +242,7 @@ mod test { #[test] fn buffer_test() { // Test vector. - let size = 10 * DEFAULT_BUF_SIZE; + let size = 10 * default_buf_size(); let mut input = Vec::with_capacity(size); let mut v = 0u8; for _ in 0..size { @@ -261,11 +261,11 @@ mod test { // Gather some stats to make it easier to figure out whether // this test is working. - let stats_count = 2 * DEFAULT_BUF_SIZE; + let stats_count = 2 * default_buf_size(); let mut stats = vec![0usize; stats_count]; for i in 0..input.len() { - let data = reader.data(DEFAULT_BUF_SIZE + 1).unwrap().to_vec(); + let data = reader.data(default_buf_size() + 1).unwrap().to_vec(); assert!(!data.is_empty()); assert_eq!(data, reader.buffer()); // And, we may as well check to make sure we read the |