Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #11 from opq-osc/beta
Browse files Browse the repository at this point in the history
fix 框架内置消息记录读取CPU占用过高
  • Loading branch information
mcoo authored Jun 15, 2021
2 parents 1612825 + 0020ce5 commit 878edf1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ func main() {
opqBot.Send(OPQBot.SendMsgPack{
SendToType: OPQBot.SendToTypeGroup,
ToUserUid: packet.FromGroupID,
Content: OPQBot.SendTypeTextMsgContent{Content: OPQBot.MacroAt([]int64{packet.FromUserID}) + "5s撤回测试\n" + OPQBot.MacroId()},
Content: OPQBot.SendTypeTextMsgContent{Content: OPQBot.MacroAt([]int64{packet.FromUserID}) + "20s撤回测试\n" + OPQBot.MacroId()},
CallbackFunc: func(Code int, Info string, record OPQBot.MyRecord) {
time.Sleep(5 * time.Second)
time.Sleep(20 * time.Second)
_ = opqBot.ReCallMsg(record.FromGroupID, record.MsgRandom, record.MsgSeq)
},
})
Expand Down
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,9 @@ func (b *BotManager) RegSendMiddleware(priority int, f func(m map[string]interfa
b.middleware = append(b.middleware, middle)
return nil
}
func (b *BotManager) CallFunc(FuncName string, funcstruct interface{}) {

}
func (b *BotManager) receiveSendPack() {
log.Println("QQ发送信息通道开启")
OuterLoop:
Expand Down Expand Up @@ -1188,12 +1190,11 @@ OuterLoop:
b.myRecordLocker.Lock()
if v, ok := b.myRecord[id[1]]; ok {
ch <- v

delete(b.myRecord, id[1])

}
b.myRecordLocker.Unlock()
}
time.Sleep(100 * time.Millisecond)

}
}()
Expand Down

0 comments on commit 878edf1

Please sign in to comment.