feat(admin): 运行时策略 - 配置对象存储策略与默认并发

This commit is contained in:
ddcat666
2026-09-29 08:26:13 +08:00
parent 387d3562ad
commit bcccddb4e9
12 changed files with 207 additions and 48 deletions

View File

@@ -24,7 +24,7 @@ type localRateEntry struct {
const (
MinChannelConcurrencyLimit = 1
MaxChannelConcurrencyLimit = maxRuntimeConcurrency
defaultChannelConcurrencyValue = 3
defaultChannelConcurrencyValue = 8
)
type channelSlotError struct {
@@ -381,13 +381,17 @@ func envInt(key string, fallback int) int {
return value
}
func defaultWorkerConcurrencyLimit() int {
return envInt("CANVAS_WORKER_CONCURRENCY", defaultWorkerConcurrency)
}
func defaultChannelConcurrencyLimit() int {
return effectiveChannelConcurrencyLimit(envInt("CANVAS_CHANNEL_CONCURRENCY", defaultChannelConcurrencyValue))
return envInt("CANVAS_CHANNEL_CONCURRENCY", defaultChannelConcurrencyValue)
}
func effectiveChannelConcurrencyLimit(configured int) int {
if configured < MinChannelConcurrencyLimit || configured > MaxChannelConcurrencyLimit {
return defaultChannelConcurrencyValue
return defaultChannelConcurrencyLimit()
}
return configured
}