walkor / walkor/GatewayWorker

\GatewayClient\Gateway::sendToGroup在高并发场景中很难确保发送成功

Open
#77 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
1k
Forks
291
PR merge metrics
No merged PRs in 30d

Description

最近在一个大流量活动中使用了Workerman/GatewayWorker,发现在后台群推消息时,偶发会出现部分接收方无法接收消息的问题。

日志中表现为:

![image](https://user-images.githubusercontent.com/13899502/119324042-f45e8300-bcb1-11eb-9bf2-10570ea9c20f.png)

大概就是在

```
} // 运行在其它环境中,通过注册中心得到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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.