国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

自定義進(jìn)程監(jiān)聽redis 重啟報(bào)錯(cuò)

zhaogh

問題描述

新增了個(gè)process用來監(jiān)聽redis過期的key,但是發(fā)現(xiàn)重啟stop的時(shí)候報(bào)了錯(cuò)誤
Workerman[start.php] stopping ...
worker[redis.notify_ex:15627] exit with status 9
Workerman[start.php] has been stopped
Workerman[start.php] start in DEBUG mode

想請(qǐng)教一下如何解決這個(gè)status 9的異常退出問題呢?

程序代碼

<?php
namespace process;

use app\constants\TalkEventConstant;
use app\service\message\MessageSubscribeHandleService;
use support\Message;
use support\Redis;

class RedisNotifyEx
{
    public function onWorkerStart()
    {
        Redis::setOption(\Redis::OPT_READ_TIMEOUT, -1);
        Redis::setOption(\Redis::OPT_PREFIX, '');

        $redisPrefix = env('REDIS_PREFIX', '');

        Redis::pSubscribe(['__keyevent@0__:expired'], function ($key, $event) use ($redisPrefix) {
            if (!preg_match('/^' . $redisPrefix . '/', $key)) {
                return;
            }

            echo 'RedisNotifyEx:' . __LINE__ . PHP_EOL;
            echo 'key:' . $key . PHP_EOL;
            echo 'event:' . $event . PHP_EOL;

            if (preg_match("/^{$redisPrefix}rds-string:at-tip/", $key)) { // AT提醒過期
                $arr = explode(':', $key);

                [$groupId, $userId] = explode('_', $arr[3]);

                MessageSubscribeHandleService::instance()->handle(
                    Message::create(TalkEventConstant::GROUP_AT_TIP_REMOVE, [
                        'group_id' => $groupId,
                        'user_id' => $userId,
                    ])
                );

                echo 'is_at!!!!' . PHP_EOL;
            }
        });
    }
}

報(bào)錯(cuò)信息

Workerman[start.php] stopping ...
worker[redis.notify_ex:15627] exit with status 9
Workerman[start.php] has been stopped
Workerman[start.php] start in DEBUG mode
-------------------------------------------------------- WORKERMAN --------------------------------------------------------
Workerman version:4.1.13          PHP version:8.1.21           Event-Loop:\Workerman\Events\Event
--------------------------------------------------------- WORKERS ---------------------------------------------------------
proto   user            worker                                   listen                      processes    status           
tcp     www             webman                                   http://0.0.0.0:8787         16            [OK]            
tcp     www             monitor                                  none                        1             [OK]            
tcp     www             redis.notify_ex                          none                        1             [OK]            
tcp     www             plugin.tinywan.rpc.text.protocol         text://0.0.0.0:9512         4             [OK]            
tcp     www             plugin.webman.stomp.consumer             none                        1             [OK]            
tcp     www             plugin.webman.gateway-worker.gateway     websocket://0.0.0.0:7272    4             [OK]            
tcp     www             plugin.webman.gateway-worker.worker      none                        8             [OK]            
tcp     www             plugin.webman.gateway-worker.register    text://127.0.0.1:1236       1             [OK]            
tcp     www             plugin.webman.redis-queue.consumer       none                        8             [OK]            
---------------------------------------------------------------------------------------------------------------------------
536 1 0
1個(gè)回答

latin

進(jìn)程一直在運(yùn)行 pSubscribe 上,無法退出,被主進(jìn)程強(qiáng)行退出了,正?,F(xiàn)象,不用管。
如果在意就用 workerman/redis 去pSubscribe

  • zhaogh 2024-05-17

    謝謝大佬,已改為workerman/redis

年代過于久遠(yuǎn),無法發(fā)表回答
??