Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.x版本消息监听延迟严重,当在群里@人后,会导致消息监听不及时,有很大的延时,已经找到原因 #207

Open
leochen-g opened this issue Jul 16, 2022 · 2 comments

Comments

@leochen-g
Copy link
Contributor

1.x版本的 puppet-wechat新增了一个消息的属性mentionIdList,顾名思义是获取消息中mention的用户id,但是正是因为有这个方法,会导致消息延时严重,我本地测试了一下,在没有@人的情况下时间是 0.577ms,当在群里有一个@的时候时间已经是6.3s,

测试时间截图
image
image

主要影响的方法:

测试后发现如果有@人员,会导致循环所有群内成员,如果遇到同名群,会循环查询多次,而这个查询同样是耗时操作,最后导致消息事件延时严重,目前正寻找解决方法,同时希望能得到 @huan 的帮助来一块看一下

image

image

@huan
Copy link
Member

huan commented Jul 17, 2022

Thanks for locating this part of the code!

It might have performance issues related to this part of the code. However, this code has been used for many years, and it was not introduced by the v1.x upgrade in the past year.

Just F.Y.I.

@gtyhn
Copy link

gtyhn commented Jul 24, 2022

同样遇到此问题,刚开始我还怀疑是用 ts 写的代码性能有问题,后来发现在群里不使用@能很快收到消息,一旦有@,延迟至少四五秒以上,有没解决办法?不行的话我得先把 mention 功能给屏了尝试自己解析了,要不然这功能没法用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants