fix: 修改跟单状态时使用 restartMonitoring 确保状态同步

- 在 updateCopyTradingStatus 中使用 restartMonitoring 替代 addLeaderMonitoring/removeLeaderMonitoring
- 确保启用/禁用跟单时,轮询监听状态完全同步
- 避免部分更新导致的状态不一致问题
This commit is contained in:
WrBug
2025-12-03 06:37:06 +08:00
parent 8bac55b943
commit ea8df61c59
@@ -162,16 +162,12 @@ class CopyTradingService(
val saved = copyTradingRepository.save(updated)
// 更新监听状态
// 重新启动监听(确保状态完全同步)
kotlinx.coroutines.runBlocking {
try {
if (saved.enabled) {
monitorService.addLeaderMonitoring(saved.leaderId)
} else {
monitorService.removeLeaderMonitoring(saved.leaderId)
}
monitorService.restartMonitoring()
} catch (e: Exception) {
logger.error("更新Leader监听状态失败: leaderId=${saved.leaderId}", e)
logger.error("重新启动跟单监听失败", e)
}
}