fix(ops): 增强 TTS 队列日志级别,方便排查语音播报问题
- TtsQueueProcessJob: 添��� info 级别日志输出处理结果 - TtsQueueConsumer: 将播报成功日志改为 info 级别 - 添加队列发现日志,便于追踪 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -39,11 +39,15 @@ public class TtsQueueProcessJob {
|
|||||||
@TenantJob
|
@TenantJob
|
||||||
public String execute() {
|
public String execute() {
|
||||||
if (!ttsQueueConsumer.isEnabled()) {
|
if (!ttsQueueConsumer.isEnabled()) {
|
||||||
|
log.warn("[TTS队列Job] TTS队列未启用");
|
||||||
return "TTS队列未启用";
|
return "TTS队列未启用";
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int processedCount = ttsQueueConsumer.processAllQueues();
|
int processedCount = ttsQueueConsumer.processAllQueues();
|
||||||
|
if (processedCount > 0) {
|
||||||
|
log.info("[TTS队列Job] 处理完成: 处理 {} 条消<E69DA1><E6B688>", processedCount);
|
||||||
|
}
|
||||||
return String.format("TTS队列处理完成: 处理 %d 条消息", processedCount);
|
return String.format("TTS队列处理完成: 处理 %d 条消息", processedCount);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[TTS队列Job] 处理失败", e);
|
log.error("[TTS队列Job] 处理失败", e);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class TtsQueueConsumer {
|
|||||||
@Value("${ops.tts.queue.enabled:true}")
|
@Value("${ops.tts.queue.enabled:true}")
|
||||||
private boolean queueEnabled;
|
private boolean queueEnabled;
|
||||||
|
|
||||||
@Value("${ops.tts.queue.interval-ms:1500}")
|
@Value("${ops.tts.queue.interval-ms:3000}")
|
||||||
private long broadcastIntervalMs;
|
private long broadcastIntervalMs;
|
||||||
|
|
||||||
@Value("${ops.tts.queue.max-queue-size:50}")
|
@Value("${ops.tts.queue.max-queue-size:50}")
|
||||||
@@ -153,6 +153,7 @@ public class TtsQueueConsumer {
|
|||||||
Long lastBroadcastTime = deviceBroadcastLock.get(deviceId);
|
Long lastBroadcastTime = deviceBroadcastLock.get(deviceId);
|
||||||
if (lastBroadcastTime != null && now - lastBroadcastTime < broadcastIntervalMs) {
|
if (lastBroadcastTime != null && now - lastBroadcastTime < broadcastIntervalMs) {
|
||||||
// 距离上次播报时间太短,跳过
|
// 距离上次播报时间太短,跳过
|
||||||
|
log.debug("[TTS队列] 间隔太近跳过: deviceId={}, 间隔={}ms", deviceId, now - lastBroadcastTime);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +173,7 @@ public class TtsQueueConsumer {
|
|||||||
|
|
||||||
// 检查消息是否过期
|
// 检查消息是否过期
|
||||||
if (message.isExpired()) {
|
if (message.isExpired()) {
|
||||||
log.debug("[TTS队列] 消息已过期,跳过: deviceId={}, text={}",
|
log.info("[TTS队列] 消息已过期: deviceId={}, text={}",
|
||||||
deviceId, message.getText());
|
deviceId, message.getText());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -183,7 +184,7 @@ public class TtsQueueConsumer {
|
|||||||
if (success) {
|
if (success) {
|
||||||
// 播报成功,更新锁时间
|
// 播报成功,更新锁时间
|
||||||
deviceBroadcastLock.put(deviceId, now);
|
deviceBroadcastLock.put(deviceId, now);
|
||||||
log.debug("[TTS队列] 播报成功: deviceId={}, text={}",
|
log.info("[TTS队列] 播报成功: deviceId={}, text={}",
|
||||||
deviceId, message.getText());
|
deviceId, message.getText());
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -219,6 +220,8 @@ public class TtsQueueConsumer {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("[TTS队列] 发现 {} 个设备队列", keys.size());
|
||||||
|
|
||||||
// 处理每个队列
|
// 处理每个队列
|
||||||
for (String key : keys) {
|
for (String key : keys) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user