缓解io压力
This commit is contained in:
@@ -18,6 +18,12 @@ const PollingDequeueMaxBatchSize = 7000
|
||||
// 300:支撑 10M 卡、2小时 carddata 间隔(Gateway 200ms → 300并发 = 1500任务/秒/类型)
|
||||
const PollingDefaultMaxConcurrency = 300
|
||||
|
||||
// PollingDefaultTotalMaxConcurrency 全部轮询任务共享的默认总并发上限。
|
||||
const PollingDefaultTotalMaxConcurrency = 100
|
||||
|
||||
// PollingMaxConcurrencyLimit 轮询并发配置的代码安全上限。
|
||||
const PollingMaxConcurrencyLimit = 1000
|
||||
|
||||
// PollingConcurrencyKeyTTL 并发计数 key 的过期时间(秒)
|
||||
// 保证 Worker 意外崩溃(defer Decr 未执行)时计数器在此时间内自动归零
|
||||
const PollingConcurrencyKeyTTL = 600 // 10 分钟
|
||||
|
||||
@@ -289,6 +289,11 @@ func RedisPollingConcurrencyCurrentKey(taskType string) string {
|
||||
return fmt.Sprintf("polling:concurrency:current:%s", taskType)
|
||||
}
|
||||
|
||||
// RedisPollingConcurrencyTotalCurrentKey 返回全部轮询共享的并发计数键。
|
||||
func RedisPollingConcurrencyTotalCurrentKey() string {
|
||||
return "polling:concurrency:current:total"
|
||||
}
|
||||
|
||||
// RedisPollingManualQueueKey 生成手动触发队列的 Redis 键
|
||||
// 用途:List 存储手动触发的卡 ID(FIFO 队列)
|
||||
// 过期时间:无(临时队列)
|
||||
|
||||
Reference in New Issue
Block a user