Skip to content

Commit

Permalink
bug: 环境管理节点列表ws推送导致的列表刷新,用户行为添加的参数未带上 TencentBlueKing#10205
Browse files Browse the repository at this point in the history
  • Loading branch information
jianingzhao616 committed Apr 12, 2024
1 parent ab7b215 commit c9281b9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ class ThirdPartyAgentHeartBeatJob @Autowired constructor(
}
nodeDao.updateNodeStatus(context, record.nodeId, NodeStatus.ABNORMAL)
}
webSocketDispatcher.dispatch(
nodeWebsocketService.buildDetailMessage(record.projectId, "")
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import com.tencent.devops.common.auth.api.ActionId
import com.tencent.devops.common.auth.api.AuthPermission
import com.tencent.devops.common.auth.api.ResourceTypeId
import com.tencent.devops.common.web.utils.I18nUtil
import com.tencent.devops.common.websocket.dispatch.WebSocketDispatcher
import com.tencent.devops.environment.constant.EnvironmentMessageCode.ERROR_ENV_NO_DEL_PERMISSSION
import com.tencent.devops.environment.constant.EnvironmentMessageCode.ERROR_NODE_CHANGE_USER_NOT_SUPPORT
import com.tencent.devops.environment.constant.EnvironmentMessageCode.ERROR_NODE_NAME_DUPLICATE
Expand Down Expand Up @@ -86,8 +85,6 @@ class NodeService @Autowired constructor(
private val thirdPartyAgentDao: ThirdPartyAgentDao,
private val slaveGatewayService: SlaveGatewayService,
private val environmentPermissionService: EnvironmentPermissionService,
private val nodeWebsocketService: NodeWebsocketService,
private val webSocketDispatcher: WebSocketDispatcher,
private val slaveGatewayDao: SlaveGatewayDao
) {
companion object {
Expand Down Expand Up @@ -137,9 +134,6 @@ class NodeService @Autowired constructor(
existNodeIdList.forEach {
environmentPermissionService.deleteNode(projectId, it)
}
webSocketDispatcher.dispatch(
nodeWebsocketService.buildDetailMessage(projectId, userId)
)
}
}

Expand Down Expand Up @@ -526,9 +520,6 @@ class NodeService @Autowired constructor(
if (nodeInDb.displayName != displayName) {
environmentPermissionService.updateNode(userId, projectId, nodeId, displayName)
}
webSocketDispatcher.dispatch(
nodeWebsocketService.buildDetailMessage(projectId, userId)
)
}
}

Expand All @@ -553,8 +544,8 @@ class NodeService @Autowired constructor(
val count = nodeDao.countForAuth(dslContext, projectId)
return Page(
count = count.toLong(),
page = offset!!,
pageSize = limit!!,
page = offset,
pageSize = limit,
records = nodeInfos.map { NodeStringIdUtils.getNodeBaseInfo(it) }
)
}
Expand All @@ -574,8 +565,8 @@ class NodeService @Autowired constructor(
)
return Page(
count = count.toLong(),
page = offset!!,
pageSize = limit!!,
page = offset,
pageSize = limit,
records = nodeInfos.map { NodeStringIdUtils.getNodeBaseInfo(it) }
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@ import com.tencent.devops.common.auth.api.ResourceTypeId
import com.tencent.devops.common.redis.RedisOperation
import com.tencent.devops.common.redis.concurrent.SimpleRateLimiter
import com.tencent.devops.common.web.utils.I18nUtil
import com.tencent.devops.common.websocket.dispatch.WebSocketDispatcher
import com.tencent.devops.environment.TpaLock
import com.tencent.devops.environment.constant.EnvironmentMessageCode
import com.tencent.devops.environment.dao.NodeDao
import com.tencent.devops.environment.dao.thirdpartyagent.ThirdPartyAgentDao
import com.tencent.devops.environment.permission.EnvironmentPermissionService
import com.tencent.devops.environment.pojo.enums.NodeStatus
import com.tencent.devops.environment.pojo.enums.NodeType
import com.tencent.devops.environment.service.NodeWebsocketService
import com.tencent.devops.environment.service.slave.SlaveGatewayService
import org.jooq.DSLContext
import org.jooq.impl.DSL
Expand All @@ -73,8 +71,6 @@ class ImportService @Autowired constructor(
private val nodeDao: NodeDao,
private val slaveGatewayService: SlaveGatewayService,
private val environmentPermissionService: EnvironmentPermissionService,
private val webSocketDispatcher: WebSocketDispatcher,
private val websocketService: NodeWebsocketService,
private val simpleRateLimiter: SimpleRateLimiter
) {

Expand Down Expand Up @@ -193,7 +189,7 @@ class ImportService @Autowired constructor(
projectId = projectId,
ip = agentRecord.ip,
name = agentRecord.hostname,
osName = agentRecord.os.toLowerCase(),
osName = agentRecord.os.lowercase(),
status = NodeStatus.NORMAL,
type = NodeType.THIRDPARTY,
userId = userId,
Expand Down Expand Up @@ -223,7 +219,6 @@ class ImportService @Autowired constructor(
nodeName = "$nodeStringId(${agentRecord.ip})"
)
}
webSocketDispatcher.dispatch(websocketService.buildDetailMessage(projectId = projectId, userId = userId))
return nodeId
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -993,9 +993,6 @@ class ThirdPartyAgentMgrService @Autowired(required = false) constructor(
if (record.nodeId != null) {
environmentPermissionService.deleteNode(projectId = projectId, nodeId = record.nodeId)
}
webSocketDispatcher.dispatch(
websocketService.buildDetailMessage(projectId, userId)
)
}
}

Expand Down Expand Up @@ -1275,9 +1272,6 @@ class ThirdPartyAgentMgrService @Autowired(required = false) constructor(
nodeRecord.nodeStatus = NodeStatus.NORMAL.name
nodeRecord.nodeIp = newHeartbeatInfo.agentIp
nodeDao.saveNode(dslContext = context, nodeRecord = nodeRecord)
webSocketDispatcher.dispatch(
websocketService.buildDetailMessage(projectId, "")
)
}
}
AgentStatus.IMPORT_OK
Expand Down Expand Up @@ -1379,9 +1373,6 @@ class ThirdPartyAgentMgrService @Autowired(required = false) constructor(
thirdPartyAgentDao.addAgentAction(context, projectId, agentRecord.id, AgentAction.ONLINE.name)
if (agentRecord.nodeId != null) {
nodeDao.updateNodeStatus(context, agentRecord.nodeId, NodeStatus.NORMAL)
webSocketDispatcher.dispatch(
websocketService.buildDetailMessage(projectId, "")
)
}
AgentStatus.IMPORT_OK
}
Expand All @@ -1403,9 +1394,6 @@ class ThirdPartyAgentMgrService @Autowired(required = false) constructor(
createUser = agentRecord.createdUser ?: "",
os = agentRecord.os ?: ""
)
webSocketDispatcher.dispatch(
websocketService.buildDetailMessage(projectId, "")
)
logger.info("Update the node status - $count of agent $agentId")
}
}
Expand Down

0 comments on commit c9281b9

Please sign in to comment.