Giter VIP home page Giter VIP logo

Comments (5)

onanying avatar onanying commented on June 2, 2024

看代码是 swoole client 本身抛出的异常,你是不是没有处理连接失败的情况?可能被你 try/catch 给掩盖了?

from redis-subscriber.

Slairmy avatar Slairmy commented on June 2, 2024

这里我用的是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.

onanying avatar onanying commented on June 2, 2024

你可能需要找一下 hf 那边问一下,有可能重试那里有点问题

from redis-subscriber.

Slairmy avatar Slairmy commented on June 2, 2024

这个问题有点奇怪,hyperf那边有retry机制,因为在retry的时候在失败的同时打印出了失败日志,然后让我觉得它一直失败了,其实可能它第一次失败了,在hyperf层面第二次retry他就成功了,但是问题最终感觉还是会想:
1、为什么 redis-subscriber 会通过了 redis 的 connection,但是在send的时候却找不到链接了。
2、在send的时候是否需要加一层重连机制

因为是线上出现的error,本地无法复线,只能通过模拟在send之前sleep一会再断掉redis服务,得到了相同的报错喝相同的trace。

from redis-subscriber.

onanying avatar onanying commented on June 2, 2024

$redissub->send() 异常,需要丢弃这个 $redissub,重新 $redissub = new Subscriber();哦

from redis-subscriber.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.