/user/info and /user/avatar hang for 75s when number is a phone number

未关闭 适合新手
#223 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@danie1net0 已经在做这个了。

开始于 2026年11月2日。

  • #224 来自 @danie1net0 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go
领域
api, backend

调研方向

从 utils.ParseJID 和 utils.CreateJID 开始,然后检查 send_service.go 中去除 + 的部分,issue 中说明发送功能已经正常工作。检查 /user/info 和 /user/avatar 是否通过 ParseJID 解析 number,并确认 + 能够传递到 JID.User。在 ParseJID 中为 s.whatsapp.net 从 JID.User 删除 +,并更新 TestParseJID。完成标准是两个接口对电话号码都能快速返回,IsOnWhatsApp 仍然接收到 +,且测试全部通过。开始之前,请先确认作者提到的 PR 中是否已经包含这项工作。

由索引模型根据 Issue 内容生成。

描述

Description

POST /user/info and POST /user/avatar time out when number is a plain phone number (5511999999999 or +5511999999999). The request blocks until the IQ timeout (~75s) and returns 500 with info query timed out.

The same contact passed as a full JID ([email protected]) answers in well under a second.

Steps to reproduce
  1. Connect an instance.
  2. POST /user/info with {"number": ["5511999999999"]} → 500 after ~75s (failed to send usync query: info query timed out).
  3. POST /user/avatar with {"number": "5511999999999"} → 500 after ~75s (info query timed out).
  4. Repeat with [email protected] → 200 in ~0.3s.
Cause

utils.CreateJID returns +<number>@s.whatsapp.net. The + is intended for IsOnWhatsApp, but utils.ParseJID passes that string to types.ParseJID, so the + ends up in JID.User. The log shows the request going to [email protected], and WhatsApp never answers queries for that JID.

Sending messages works because send_service.go strips the + from the recipient right before SendMessage. Other code paths that use ParseJID don't.

Proposed fix

Strip the + from JID.User in utils.ParseJID when the server is s.whatsapp.net. CreateJID stays unchanged, so IsOnWhatsApp still gets the +. TestParseJID currently expects the + in the output and needs to be updated.

Possibly the same root cause as #28: /message/react also resolves number with ParseJID, and /send/text worked there because of the strip in send_service.go. I only tested /user/info and /user/avatar.

I have a PR ready for this.

Environment
  • Evolution GO develop @ 7f79240
主要语言
Go
星标
971
派生
519
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

evolution-foundation/evolution-go 的其他 Issue

查看 evolution-foundation/evolution-go 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。