webman监听MNS消息队列,无法实时消费,每次消费中间间隔不定的时间

adminadmin

webman监听MNS消息队列,无法实时消费,每次消费中间间隔不定的时间

数据库的执行几乎不耗费时间,不是数据库等待时间
请问还可以从哪些方面去找问题

也报这个错误 worker[task:2630] exit with status 9

根据帖子https://www.workerman.net/q/8287进行了修改,依然报错

首先开自定义进程


   public function onWorkerStart()
    {

        $endPoint = '1';
        $accessId = "2";
        $accessKey = "3";

         //队列名称
        $queueName = "buyorder-settle";
        $client = new Client($endPoint, $accessId, $accessKey);
        $queue = $client->getQueueRef($queueName);

        pcntl_signal(SIGINT, function () {
            Worker::stopAll();
        });

        while (true) {
            try {

               $t1_start=time();

               $res = $queue->receiveMessage(1);
                $receiptHandle = $res->getReceiptHandle();
                //接收消息
                $r = $res->getMessageBody();

                    $update_o = [
                        'buyorder_status' => "finish",
                    ];
                    $r1 = Db::name("buy_order")
                        ->where("buyorder_id", $r['order_id'])->update($update_o);

                    if ($r1) {
                          $delete_action = $queue->deleteMessage($receiptHandle);
                          $haoshi=time()-$t1_start;
                          print(date('Y-m-d H:i:s')."---完成--耗时".$haoshi."s"."\r\n");
                          pcntl_signal_dispatch();
                    }

            } catch (\Throwable $throwable) {

            }
        }

    }

MNS应该如何填写参数
截图

为此你搜索到了哪些方案及不适用的原因

根据这个帖子改了还是不行
https://www.workerman.net/q/8287
https://www.workerman.net/q/9385

877 0 0
0个回答

年代过于久远,无法发表回答
×
🔝