File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -48,9 +48,14 @@ public function keepMin(?int $num = null): int
4848 */
4949 protected function itemIntervalCheck ($ item ): bool
5050 {
51+ if (!isset ($ item ->__lastPingTime )){
52+ $ item ->__lastPingTime = 0 ;
53+ }
5154 if (time () - $ item ->__lastPingTime > 10 ){
5255 try {
53- return $ item ->ping ();
56+ $ ret = $ item ->ping ();
57+ $ item ->__lastPingTime = time ();
58+ return $ ret ;
5459 }catch (\Throwable $ throwable ){
5560 //异常说明该链接出错了,return false 进行回收
5661 return false ;
Original file line number Diff line number Diff line change 44namespace EasySwoole \Queue \Driver ;
55
66
7- use EasySwoole \Pool \MagicPool ;
7+ use EasySwoole \Queue \ Driver \ Pool \RedisPool ;
88use EasySwoole \Queue \Job ;
99use EasySwoole \Queue \QueueDriverInterface ;
1010use EasySwoole \Redis \Config ;
@@ -20,11 +20,9 @@ class RedisQueue implements QueueDriverInterface
2020
2121 public function __construct (Config $ config ,string $ queueName = 'es_q ' )
2222 {
23- $ this ->pool = new MagicPool (function ()use ($ config ){
24- $ redis = new Redis ($ config );
25- $ redis ->connect ();
26- return $ redis ;
27- });
23+ $ poolConfig = new PoolConfig ();
24+ $ poolConfig ->setExtraConf ($ config );
25+ $ this ->pool = new RedisPool ($ poolConfig );
2826 $ this ->queueName = $ queueName ;
2927 }
3028
You can’t perform that action at this time.
0 commit comments