@@ -9,8 +9,8 @@ class Client
99{
1010
1111 // 键名
12- const KEY_JOP_POOL = 'delayer:jop_pool ' ;
13- const PREFIX_JOP_BUCKET = 'delayer:jop_bucket : ' ;
12+ const KEY_JOB_POOL = 'delayer:job_pool ' ;
13+ const PREFIX_JOB_BUCKET = 'delayer:job_bucket : ' ;
1414 const PREFIX_READY_QUEUE = 'delayer:ready_queue: ' ;
1515
1616 // 连接地址
@@ -71,9 +71,9 @@ public function push(Message $message, $delayTime, $readyMaxLifetime = 604800)
7171 }
7272 // 增加
7373 $ this ->_driver ->multi ();
74- $ this ->_driver ->hMset (self ::PREFIX_JOP_BUCKET . $ message ->id , ['topic ' => $ message ->topic , 'body ' => $ message ->body ]);
75- $ this ->_driver ->expire (self ::PREFIX_JOP_BUCKET . $ message ->id , $ delayTime + $ readyMaxLifetime );
76- $ this ->_driver ->zAdd (self ::KEY_JOP_POOL , time () + $ delayTime , $ message ->id );
74+ $ this ->_driver ->hMset (self ::PREFIX_JOB_BUCKET . $ message ->id , ['topic ' => $ message ->topic , 'body ' => $ message ->body ]);
75+ $ this ->_driver ->expire (self ::PREFIX_JOB_BUCKET . $ message ->id , $ delayTime + $ readyMaxLifetime );
76+ $ this ->_driver ->zAdd (self ::KEY_JOB_POOL , time () + $ delayTime , $ message ->id );
7777 $ ret = $ this ->_driver ->exec ();
7878 foreach ($ ret as $ status ) {
7979 if (!$ status ) {
@@ -94,11 +94,11 @@ public function pop($topic)
9494 if (empty ($ id )) {
9595 return false ;
9696 }
97- $ data = $ this ->_driver ->hGetAll (self ::PREFIX_JOP_BUCKET . $ id );
97+ $ data = $ this ->_driver ->hGetAll (self ::PREFIX_JOB_BUCKET . $ id );
9898 if (!isset ($ data ['topic ' ]) || !isset ($ data ['body ' ])) {
9999 return false ;
100100 }
101- $ this ->_driver ->del (self ::PREFIX_JOP_BUCKET . $ id );
101+ $ this ->_driver ->del (self ::PREFIX_JOB_BUCKET . $ id );
102102 return new Message ([
103103 'id ' => $ id ,
104104 'topic ' => $ data ['topic ' ],
@@ -119,11 +119,11 @@ public function bPop($topic, $timeout)
119119 return false ;
120120 }
121121 $ id = array_pop ($ ret );
122- $ data = $ this ->_driver ->hGetAll (self ::PREFIX_JOP_BUCKET . $ id );
122+ $ data = $ this ->_driver ->hGetAll (self ::PREFIX_JOB_BUCKET . $ id );
123123 if (!isset ($ data ['topic ' ]) || !isset ($ data ['body ' ])) {
124124 return false ;
125125 }
126- $ this ->_driver ->del (self ::PREFIX_JOP_BUCKET . $ id );
126+ $ this ->_driver ->del (self ::PREFIX_JOB_BUCKET . $ id );
127127 return new Message ([
128128 'id ' => $ id ,
129129 'topic ' => $ data ['topic ' ],
@@ -139,8 +139,8 @@ public function bPop($topic, $timeout)
139139 public function remove ($ id )
140140 {
141141 $ this ->_driver ->multi ();
142- $ this ->_driver ->zRem (self ::KEY_JOP_POOL , $ id );
143- $ this ->_driver ->del (self ::PREFIX_JOP_BUCKET . $ id );
142+ $ this ->_driver ->zRem (self ::KEY_JOB_POOL , $ id );
143+ $ this ->_driver ->del (self ::PREFIX_JOB_BUCKET . $ id );
144144 $ ret = $ this ->_driver ->exec ();
145145 foreach ($ ret as $ status ) {
146146 if (!$ status ) {
0 commit comments