koishijs / koishi

Cross-platform chatbot framework made with love
https://koishi.chat
MIT License
4.35k stars 237 forks source link

Koishi在用户首次发送消息时出现数据库INSERT DUPLICATE ENTRY错误 #621

Closed TimeBather closed 2 years ago

TimeBather commented 2 years ago

不管是使用QQ频道Adapter还是Sandbox模拟都会有这个问题

复现方式

TimeBather commented 2 years ago

这个似乎在多个平台上都有复现,可能和Koishi的用户系统实现有关?

TimeBather commented 2 years ago

证实这个bug是由于ObserveChannel函数被调用两次产生的,第一次是由App的Process函数调用,第二次是由chat插件调用,chat插件调用位置如下: https://github.com/koishijs/koishi/blob/master/plugins/frontend/chat/src/index.ts#L71