feat: add PIPESIZE constant for consistent buffer sizes
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -2,6 +2,7 @@ use anyhow::Result;
|
||||
use rusqlite::Connection;
|
||||
|
||||
use crate::common::is_binary::is_binary;
|
||||
use crate::common::PIPESIZE;
|
||||
use crate::meta_plugin::MetaPlugin;
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
@@ -43,7 +44,7 @@ impl BinaryMetaPlugin {
|
||||
|
||||
let max_buffer_size = final_options.get("max_buffer_size")
|
||||
.and_then(|v| v.as_u64())
|
||||
.unwrap_or(4096) as usize;
|
||||
.unwrap_or(PIPESIZE as u64 / 2) as usize;
|
||||
|
||||
BinaryMetaPlugin {
|
||||
meta_name: "binary".to_string(),
|
||||
|
||||
@@ -3,6 +3,8 @@ use magic::{Cookie, CookieFlags};
|
||||
use rusqlite::Connection;
|
||||
use std::io;
|
||||
|
||||
use crate::common::PIPESIZE;
|
||||
|
||||
use crate::meta_plugin::MetaPlugin;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -23,7 +25,7 @@ impl MagicFileMetaPlugin {
|
||||
) -> MagicFileMetaPlugin {
|
||||
// Start with default options
|
||||
let mut final_options = std::collections::HashMap::new();
|
||||
final_options.insert("max_buffer_size".to_string(), serde_yaml::Value::Number(4096.into()));
|
||||
final_options.insert("max_buffer_size".to_string(), serde_yaml::Value::Number((PIPESIZE / 2).into()));
|
||||
if let Some(opts) = options {
|
||||
for (key, value) in opts {
|
||||
final_options.insert(key, value);
|
||||
@@ -44,7 +46,7 @@ impl MagicFileMetaPlugin {
|
||||
|
||||
let max_buffer_size = final_options.get("max_buffer_size")
|
||||
.and_then(|v| v.as_u64())
|
||||
.unwrap_or(4096) as usize;
|
||||
.unwrap_or((PIPESIZE / 2) as u64) as usize;
|
||||
|
||||
MagicFileMetaPlugin {
|
||||
buffer: Vec::new(),
|
||||
|
||||
Reference in New Issue
Block a user