正在显示
1 个修改的文件
包含
28 行增加
和
28 行删除
@@ -41,7 +41,7 @@ class HotMail { | @@ -41,7 +41,7 @@ class HotMail { | ||
41 | private function start(){ | 41 | private function start(){ |
42 | _echo('启动预热邮件处理 '.getmypid()); | 42 | _echo('启动预热邮件处理 '.getmypid()); |
43 | 43 | ||
44 | -// if(redis()->add('hot_mail_sync',1,60)){ | 44 | + if(redis()->add('hot_mail_sync',1,60)){ |
45 | $fob = $this->getFobHotEmail(); | 45 | $fob = $this->getFobHotEmail(); |
46 | 46 | ||
47 | // 把黑格自己的也算进去 | 47 | // 把黑格自己的也算进去 |
@@ -63,35 +63,35 @@ class HotMail { | @@ -63,35 +63,35 @@ class HotMail { | ||
63 | }catch (Throwable $e){} | 63 | }catch (Throwable $e){} |
64 | } | 64 | } |
65 | 65 | ||
66 | -// $maxId = $this->db->value("select `id` from `lists` order by `id` desc limit 1"); | ||
67 | -// $id = 0; | ||
68 | -// while (1){ | ||
69 | -// $ids = []; | ||
70 | -// for ($i=0;$i<1000;$i++){ | ||
71 | -// $ids[] = $i+$id; | ||
72 | -// } | ||
73 | -// $id = end($ids); | ||
74 | -// | ||
75 | -// redis()->rPush('hot_check_ids',implode(',',$ids)); | ||
76 | -// | ||
77 | -// if($id>$maxId){ | ||
78 | -// break; | ||
79 | -// } | ||
80 | -// } | 66 | + $maxId = $this->db->value("select `id` from `lists` order by `id` desc limit 1"); |
67 | + $id = 0; | ||
68 | + while (1){ | ||
69 | + $ids = []; | ||
70 | + for ($i=0;$i<1000;$i++){ | ||
71 | + $ids[] = $i+$id; | ||
72 | + } | ||
73 | + $id = end($ids); | ||
81 | 74 | ||
82 | -// } | 75 | + redis()->rPush('hot_check_ids',implode(',',$ids)); |
76 | + | ||
77 | + if($id>$maxId){ | ||
78 | + break; | ||
79 | + } | ||
80 | + } | ||
81 | + | ||
82 | + } | ||
83 | 83 | ||
84 | 84 | ||
85 | -// while (1){ | ||
86 | -// $ids = redis()->lPop('hot_check_ids'); | ||
87 | -// if($ids){ | ||
88 | -// $ids = explode(',',$ids); | ||
89 | -// $this->run($ids); | ||
90 | -// }else{ | ||
91 | -// echo '等待'.PHP_EOL; | ||
92 | -// co::sleep(2); | ||
93 | -// } | ||
94 | -// } | 85 | + while (1){ |
86 | + $ids = redis()->lPop('hot_check_ids'); | ||
87 | + if($ids){ | ||
88 | + $ids = explode(',',$ids); | ||
89 | + $this->run($ids); | ||
90 | + }else{ | ||
91 | + echo '等待'.PHP_EOL; | ||
92 | + co::sleep(2); | ||
93 | + } | ||
94 | + } | ||
95 | 95 | ||
96 | 96 | ||
97 | 97 | ||
@@ -174,7 +174,7 @@ swoole_set_process_name('hot-email-run-man'); | @@ -174,7 +174,7 @@ swoole_set_process_name('hot-email-run-man'); | ||
174 | 174 | ||
175 | $pm = new Swoole\Process\Manager(); | 175 | $pm = new Swoole\Process\Manager(); |
176 | 176 | ||
177 | -$pm->addBatch(1,function (){ | 177 | +$pm->addBatch(10,function (){ |
178 | 178 | ||
179 | swoole_set_process_name('hot-email-run'); | 179 | swoole_set_process_name('hot-email-run'); |
180 | 180 |
-
请 注册 或 登录 后发表评论