Comments (5)
看代码是 swoole client 本身抛出的异常,你是不是没有处理连接失败的情况?可能被你 try/catch 给掩盖了?
from redis-subscriber.
这里我用的是hyperf/socketio-service 组件,它使用 redis-subscribe 来进行数据广播,在 socketio-service 层面做了重试机制
public function subscribe()
{
Coroutine::create(function () {
CoordinatorManager::until(Constants::WORKER_START)->yield();
retry(PHP_INT_MAX, function () {
try {
$sub = make(Subscriber::class);
if ($sub) {
$this->mixSubscribe($sub);
} else {
// Fallback to PhpRedis, which has a very bad blocking subscribe model.
$this->phpRedisSubscribe();
}
} catch (\Throwable $e) {
$container = ApplicationContext::getContainer();
if ($container->has(StdoutLoggerInterface::class)) {
$logger = $container->get(StdoutLoggerInterface::class);
$logger->error($this->formatThrowable($e));
}
throw $e;
}
}, $this->retryInterval);
});
}
但是有点一直重试一直失败的感觉
from redis-subscriber.
你可能需要找一下 hf 那边问一下,有可能重试那里有点问题
from redis-subscriber.
这个问题有点奇怪,hyperf那边有retry机制,因为在retry的时候在失败的同时打印出了失败日志,然后让我觉得它一直失败了,其实可能它第一次失败了,在hyperf层面第二次retry他就成功了,但是问题最终感觉还是会想:
1、为什么 redis-subscriber 会通过了 redis 的 connection,但是在send的时候却找不到链接了。
2、在send的时候是否需要加一层重连机制
因为是线上出现的error,本地无法复线,只能通过模拟在send之前sleep一会再断掉redis服务,得到了相同的报错喝相同的trace。
from redis-subscriber.
$redissub->send() 异常,需要丢弃这个 $redissub,重新 $redissub = new Subscriber();哦
from redis-subscriber.
Related Issues (4)
- hyperf/socketio-server 中也依赖了 mix/redis-subscribe HOT 1
- 可否支持 psubscribe? HOT 1
- 可否支持 psubscribe? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redis-subscriber.