\GatewayClient\Gateway::sendToGroup在高并发场景中很难确保发送成功
- Dominant language
- PHP
- Stars
- 1k
- Forks
- 291
- PR merge metrics
- No merged PRs in 30d
Description
最近在一个大流量活动中使用了Workerman/GatewayWorker,发现在后台群推消息时,偶发会出现部分接收方无法接收消息的问题。
日志中表现为:

大概就是在
```
} // 运行在其它环境中,通过注册中心得到gateway地址
else {
$addresses = static::getAllGatewayAddressesFromRegister();
foreach ($addresses as $address) {
$gateway_data['ext_data'] = isset($address_connection_array[$address]) ?
json_encode(array('group'=> $group, 'exclude'=> $address_connection_array[$address])) :
$default_ext_data_buffer;
static::sendToGateway($address, $gateway_data);
}
}
```
这里获取得到gateway地址后循环调用发送。但是如果循环过程中有一个gateway挂了,后面就无法发送了。
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at Gateway::sendToGroup and inspect the shown branch that calls getAllGatewayAddressesFromRegister() and static::sendToGateway($address, $gateway_data). Trace how a failed gateway affects the loop and how failures are reported. Done means a failed gateway does not prevent messages from being attempted for the remaining gateway addresses, with the behavior verified under the reported high-concurrency scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100