嘗試以下操作
debug=>false
error_reporting=>1024
這個是webman的錯誤打印配置
trigger_error("超時重試2",E_USER_NOTICE)
還是會打印錯誤堆棧
找尋源碼 webman/queue
是對 workerman/redis-queue
的優(yōu)雅封裝,搞不定
因?yàn)槲乙呀?jīng)選擇主動拋出異常重試,堆棧信息是否保存到redis起碼可選的吧~ redis - fail表體積爆炸
vendor/workerman/redis-queue/src/Client.php pull
200行隊(duì)列回流機(jī)制 就是 接收
Exception
和Error
的錯誤,增加一個配置項(xiàng)根據(jù) 是否存儲堆棧 $package['error']即可修復(fù)$callback = $this->_subscribeQueues[$redis_key]; try { \call_user_func($callback, $package['data']); } catch (\Exception $e) { if (++$package['attempts'] > $this->_options['max_attempts']) { $package['error'] = (string) $e; $this->fail($package); } else { $this->retry($package); } echo $e; } catch (\Error $e) { if (++$package['attempts'] > $this->_options['max_attempts']) { $package['error'] = (string) $e; $this->fail($package); } else { $this->retry($package); } echo $e; }
我在已提交 pull request 如果官方合并,主動拋出異常 不會幫報錯保存到 redis fail
config/plugin/webman/redis-queue/redis.php
<?php return [ 'default' => [ 'host' => 'redis://127.0.0.1:6379', 'options' => [ 'auth' => null, // 密碼,字符串類型,可選參數(shù) 'db' => 0, // 數(shù)據(jù)庫 'prefix' => '', // key 前綴 'max_attempts' => 5, // 消費(fèi)失敗后,重試次數(shù) 'retry_seconds' => 5, // 重試間隔,單位秒 'debug' => true // 默認(rèn)false 為true主動拋出的異常 保存到失敗隊(duì)列 ] ], ];