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

Commit 878edf1

Browse files
authored
Merge pull request #11 from opq-osc/beta
fix 框架内置消息记录读取CPU占用过高
2 parents 1612825 + 0020ce5 commit 878edf1

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

example/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ func main() {
9999
opqBot.Send(OPQBot.SendMsgPack{
100100
SendToType: OPQBot.SendToTypeGroup,
101101
ToUserUid: packet.FromGroupID,
102-
Content: OPQBot.SendTypeTextMsgContent{Content: OPQBot.MacroAt([]int64{packet.FromUserID}) + "5s撤回测试\n" + OPQBot.MacroId()},
102+
Content: OPQBot.SendTypeTextMsgContent{Content: OPQBot.MacroAt([]int64{packet.FromUserID}) + "20s撤回测试\n" + OPQBot.MacroId()},
103103
CallbackFunc: func(Code int, Info string, record OPQBot.MyRecord) {
104-
time.Sleep(5 * time.Second)
104+
time.Sleep(20 * time.Second)
105105
_ = opqBot.ReCallMsg(record.FromGroupID, record.MsgRandom, record.MsgSeq)
106106
},
107107
})

main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,9 @@ func (b *BotManager) RegSendMiddleware(priority int, f func(m map[string]interfa
966966
b.middleware = append(b.middleware, middle)
967967
return nil
968968
}
969+
func (b *BotManager) CallFunc(FuncName string, funcstruct interface{}) {
969970

971+
}
970972
func (b *BotManager) receiveSendPack() {
971973
log.Println("QQ发送信息通道开启")
972974
OuterLoop:
@@ -1188,12 +1190,11 @@ OuterLoop:
11881190
b.myRecordLocker.Lock()
11891191
if v, ok := b.myRecord[id[1]]; ok {
11901192
ch <- v
1191-
11921193
delete(b.myRecord, id[1])
1193-
11941194
}
11951195
b.myRecordLocker.Unlock()
11961196
}
1197+
time.Sleep(100 * time.Millisecond)
11971198

11981199
}
11991200
}()

0 commit comments

Comments
 (0)