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 rusqlite::Connection;
|
||||||
|
|
||||||
use crate::common::is_binary::is_binary;
|
use crate::common::is_binary::is_binary;
|
||||||
|
use crate::common::PIPESIZE;
|
||||||
use crate::meta_plugin::MetaPlugin;
|
use crate::meta_plugin::MetaPlugin;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
@@ -43,7 +44,7 @@ impl BinaryMetaPlugin {
|
|||||||
|
|
||||||
let max_buffer_size = final_options.get("max_buffer_size")
|
let max_buffer_size = final_options.get("max_buffer_size")
|
||||||
.and_then(|v| v.as_u64())
|
.and_then(|v| v.as_u64())
|
||||||
.unwrap_or(4096) as usize;
|
.unwrap_or(PIPESIZE as u64 / 2) as usize;
|
||||||
|
|
||||||
BinaryMetaPlugin {
|
BinaryMetaPlugin {
|
||||||
meta_name: "binary".to_string(),
|
meta_name: "binary".to_string(),
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ use magic::{Cookie, CookieFlags};
|
|||||||
use rusqlite::Connection;
|
use rusqlite::Connection;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
|
use crate::common::PIPESIZE;
|
||||||
|
|
||||||
use crate::meta_plugin::MetaPlugin;
|
use crate::meta_plugin::MetaPlugin;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -23,7 +25,7 @@ impl MagicFileMetaPlugin {
|
|||||||
) -> MagicFileMetaPlugin {
|
) -> MagicFileMetaPlugin {
|
||||||
// Start with default options
|
// Start with default options
|
||||||
let mut final_options = std::collections::HashMap::new();
|
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 {
|
if let Some(opts) = options {
|
||||||
for (key, value) in opts {
|
for (key, value) in opts {
|
||||||
final_options.insert(key, value);
|
final_options.insert(key, value);
|
||||||
@@ -44,7 +46,7 @@ impl MagicFileMetaPlugin {
|
|||||||
|
|
||||||
let max_buffer_size = final_options.get("max_buffer_size")
|
let max_buffer_size = final_options.get("max_buffer_size")
|
||||||
.and_then(|v| v.as_u64())
|
.and_then(|v| v.as_u64())
|
||||||
.unwrap_or(4096) as usize;
|
.unwrap_or((PIPESIZE / 2) as u64) as usize;
|
||||||
|
|
||||||
MagicFileMetaPlugin {
|
MagicFileMetaPlugin {
|
||||||
buffer: Vec::new(),
|
buffer: Vec::new(),
|
||||||
|
|||||||
Reference in New Issue
Block a user