Skip to content

Commit

Permalink
[stream] 优化大仓触发耗时 TencentBlueKing#10861
Browse files Browse the repository at this point in the history
  • Loading branch information
yongyiduan committed Sep 10, 2024
1 parent 8fee9f1 commit f1a372b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,13 @@ class StreamUserMessageService @Autowired constructor(
id: Int,
projectCode: String?
): Boolean {
websocketService.pushNotifyWebsocket(userId, projectCode)
return streamUserMessageDao.readMessage(dslContext, id) >= 0
}

fun readAllMessage(
projectCode: String?,
userId: String
): Boolean {
websocketService.pushNotifyWebsocket(userId, projectCode)
return if (projectCode != null) {
streamUserMessageDao.readAllMessage(
dslContext = dslContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class StreamEventService @Autowired constructor(
private val gitCheckService: GitCheckService,
private val gitRequestEventNotBuildDao: GitRequestEventNotBuildDao,
private val gitRequestEventDao: GitRequestEventDao,
private val websocketService: StreamWebsocketService,
private val gitRequestEventBuildDao: GitRequestEventBuildDao,
private val streamGitProjectInfoCache: StreamGitProjectInfoCache,
private val userMessageConsumer: UserMessageConsumer
Expand Down Expand Up @@ -176,19 +175,13 @@ class StreamEventService @Autowired constructor(
branch = branch
)

if (saveUserMessage(
userId = userId,
projectCode = projectCode,
event = event,
gitProjectId = gitProjectId,
messageType = UserMessageType.REQUEST
)
) {
websocketService.pushNotifyWebsocket(
userId,
GitCommonUtils.getCiProjectId(gitProjectId, streamGitConfig.getScmType())
)
}
saveUserMessage(
userId = userId,
projectCode = projectCode,
event = event,
gitProjectId = gitProjectId,
messageType = UserMessageType.REQUEST
)
return messageId
}

Expand Down

0 comments on commit f1a372b

Please sign in to comment.