feat: 修复 userMessageQueue 配置缺失导致的 500 错误

- 在 config.example.js 添加缺失的 userMessageQueue 配置段
  - 在 userMessageQueueService.js 添加防御性代码,当配置未定义时使用默认值

  修复 #783 合并后新用户安装报错:
  Cannot read properties of undefined (reading 'enabled')
This commit is contained in:
QTom
2025-12-09 18:41:13 +08:00
committed by QTom
parent b76776d7b0
commit b409adf9d8
2 changed files with 22 additions and 10 deletions

View File

@@ -203,6 +203,14 @@ const config = {
development: {
debug: process.env.DEBUG === 'true',
hotReload: process.env.HOT_RELOAD === 'true'
},
// 📬 用户消息队列配置
userMessageQueue: {
enabled: process.env.USER_MESSAGE_QUEUE_ENABLED === 'true', // 默认关闭
delayMs: parseInt(process.env.USER_MESSAGE_QUEUE_DELAY_MS) || 100, // 请求间隔(毫秒)
timeoutMs: parseInt(process.env.USER_MESSAGE_QUEUE_TIMEOUT_MS) || 60000, // 队列等待超时(毫秒)
lockTtlMs: 120000 // 锁租约TTL毫秒会在请求期间自动续租以防死锁
}
}