refactor(lua): 调整配置字段顺序将协程池参数集中

将 CoroutinePoolWarmup 字段移至 CoroutineStackSize 后,
使协程相关配置字段集中在一起,便于理解和维护。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-04-14 14:53:12 +08:00
parent cf0ea6cc1f
commit 686b8c3239
3 changed files with 18 additions and 18 deletions

View File

@ -1403,9 +1403,6 @@ type LuaGlobalSettings struct {
// CodeCacheSize 字节码缓存条目数
CodeCacheSize int `yaml:"code_cache_size"`
// EnableFileWatch 启用文件变更检测
EnableFileWatch bool `yaml:"enable_file_watch"`
// MaxExecutionTime 单脚本最大执行时间
MaxExecutionTime time.Duration `yaml:"max_execution_time"`
@ -1413,11 +1410,14 @@ type LuaGlobalSettings struct {
// 较小的栈减少内存分配,适用于简单脚本
CoroutineStackSize int `yaml:"coroutine_stack_size"`
// MinimizeStackMemory 启用栈内存自动收缩以减少内存占用
MinimizeStackMemory bool `yaml:"minimize_stack_memory"`
// CoroutinePoolWarmup 协程池预热数量,启动时预创建
CoroutinePoolWarmup int `yaml:"coroutine_pool_warmup"`
// EnableFileWatch 启用文件变更检测
EnableFileWatch bool `yaml:"enable_file_watch"`
// MinimizeStackMemory 启用栈内存自动收缩以减少内存占用
MinimizeStackMemory bool `yaml:"minimize_stack_memory"`
}
// StreamConfig TCP/UDP Stream 代理配置。

View File

@ -13,13 +13,13 @@ type Config struct {
CodeCacheSize int
CodeCacheTTL time.Duration
MaxExecutionTime time.Duration
EnableFileWatch bool
EnableOSLib bool
EnableIOLib bool
EnableLoadLib bool
CoroutineStackSize int // 协程栈大小默认64最大256
CoroutineStackSize int // 协程栈大小默认64最大256
CoroutinePoolWarmup int // 协程池预热数量,启动时预创建
EnableFileWatch bool // 1
EnableOSLib bool // 1
EnableIOLib bool // 1
EnableLoadLib bool // 1
MinimizeStackMemory bool // 启用栈内存自动收缩以减少内存占用
CoroutinePoolWarmup int // 协程池预热数量,启动时预创建
}
// DefaultConfig 返回默认配置

View File

@ -40,9 +40,6 @@ type GlobalLuaSettings struct {
// CodeCacheSize 字节码缓存条目数
CodeCacheSize int `yaml:"code_cache_size"`
// EnableFileWatch 启用文件变更检测
EnableFileWatch bool `yaml:"enable_file_watch"`
// MaxExecutionTime 单脚本最大执行时间
MaxExecutionTime time.Duration `yaml:"max_execution_time"`
@ -50,11 +47,14 @@ type GlobalLuaSettings struct {
// 较小的栈减少内存分配,适用于简单脚本
CoroutineStackSize int `yaml:"coroutine_stack_size"`
// MinimizeStackMemory 启用栈内存自动收缩以减少内存占用
MinimizeStackMemory bool `yaml:"minimize_stack_memory"`
// CoroutinePoolWarmup 协程池预热数量,启动时预创建
CoroutinePoolWarmup int `yaml:"coroutine_pool_warmup"`
// EnableFileWatch 启用文件变更检测
EnableFileWatch bool `yaml:"enable_file_watch"`
// MinimizeStackMemory 启用栈内存自动收缩以减少内存占用
MinimizeStackMemory bool `yaml:"minimize_stack_memory"`
}
// DefaultMiddlewareConfig 默认 Lua 中间件配置