Skip to content

Commit

Permalink
Beta472 (#476)
Browse files Browse the repository at this point in the history
* beta447

* beta448

* beta449

* beta450

* beta451

* beta452

* beta453

* beta454

* beta455

* btea455

* beta456

* beta457

* beta458

* beta460

* beta460

* beta461

* beta462

* beta463

* beta464

* beta465

* beta467

* beta468

* beta469

* beta470

* beta471

* beta472
  • Loading branch information
Hoshinonyaruko authored Aug 1, 2024
1 parent 2793d7b commit 514ac09
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions botgo/websocket/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,19 +246,22 @@ func (c *Client) readMessageToQueue() {
payload.RawMessage = message
log.Infof("%s receive %s message, %s", c.session, dto.OPMeans(payload.OPCode), string(message))

// 计算数据的哈希值
dataHash := calculateDataHash(payload.Data)
// 不过滤心跳事件
if payload.OPCode != 11 {
// 计算数据的哈希值
dataHash := calculateDataHash(payload.Data)

// 检查是否已存在相同的 Data
if existingPayload, ok := getDataFromSyncMap(dataHash); ok {
// 如果已存在相同的 Data,则丢弃当前消息
log.Infof("%s discard duplicate message with DataHash: %v", c.session, existingPayload)
continue
}

// 检查是否已存在相同的 Data
if existingPayload, ok := getDataFromSyncMap(dataHash); ok {
// 如果已存在相同的 Data,则丢弃当前消息
log.Infof("%s discard duplicate message with DataHash: %v", c.session, existingPayload)
continue
// 将新的 payload 存入 sync.Map
storeDataToSyncMap(dataHash, payload)
}

// 将新的 payload 存入 sync.Map
storeDataToSyncMap(dataHash, payload)

// 处理内置的一些事件,如果处理成功,则这个事件不再投递给业务
if c.isHandleBuildIn(payload) {
continue
Expand Down

0 comments on commit 514ac09

Please sign in to comment.