正在显示
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,300)){ | 44 | + if(redis()->add('hot_mail_sync',1,60)){ |
45 | $fob = $this->getFobHotEmail(); | 45 | $fob = $this->getFobHotEmail(); |
46 | 46 | ||
47 | // 把黑格自己的也算进去 | 47 | // 把黑格自己的也算进去 |
@@ -62,35 +62,35 @@ class HotMail { | @@ -62,35 +62,35 @@ class HotMail { | ||
62 | }catch (Throwable $e){} | 62 | }catch (Throwable $e){} |
63 | } | 63 | } |
64 | 64 | ||
65 | - $maxId = $this->db->value("select `id` from `lists` order by `id` desc limit 1"); | ||
66 | - $id = 0; | ||
67 | - while (1){ | ||
68 | - $ids = []; | ||
69 | - for ($i=0;$i<1000;$i++){ | ||
70 | - $ids[] = $i+$id; | ||
71 | - } | ||
72 | - $id = end($ids); | ||
73 | - | ||
74 | - redis()->rPush('hot_check_ids',implode(',',$ids)); | ||
75 | - | ||
76 | - if($id>$maxId){ | ||
77 | - break; | ||
78 | - } | ||
79 | - } | 65 | +// $maxId = $this->db->value("select `id` from `lists` order by `id` desc limit 1"); |
66 | +// $id = 0; | ||
67 | +// while (1){ | ||
68 | +// $ids = []; | ||
69 | +// for ($i=0;$i<1000;$i++){ | ||
70 | +// $ids[] = $i+$id; | ||
71 | +// } | ||
72 | +// $id = end($ids); | ||
73 | +// | ||
74 | +// redis()->rPush('hot_check_ids',implode(',',$ids)); | ||
75 | +// | ||
76 | +// if($id>$maxId){ | ||
77 | +// break; | ||
78 | +// } | ||
79 | +// } | ||
80 | 80 | ||
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | - while (1){ | ||
85 | - $ids = redis()->lPop('hot_check_ids'); | ||
86 | - if($ids){ | ||
87 | - $ids = explode(',',$ids); | ||
88 | - $this->run($ids); | ||
89 | - }else{ | ||
90 | - echo '等待'.PHP_EOL; | ||
91 | - co::sleep(2); | ||
92 | - } | ||
93 | - } | 84 | +// while (1){ |
85 | +// $ids = redis()->lPop('hot_check_ids'); | ||
86 | +// if($ids){ | ||
87 | +// $ids = explode(',',$ids); | ||
88 | +// $this->run($ids); | ||
89 | +// }else{ | ||
90 | +// echo '等待'.PHP_EOL; | ||
91 | +// co::sleep(2); | ||
92 | +// } | ||
93 | +// } | ||
94 | 94 | ||
95 | 95 | ||
96 | 96 | ||
@@ -173,7 +173,7 @@ swoole_set_process_name('hot-email-run-man'); | @@ -173,7 +173,7 @@ swoole_set_process_name('hot-email-run-man'); | ||
173 | 173 | ||
174 | $pm = new Swoole\Process\Manager(); | 174 | $pm = new Swoole\Process\Manager(); |
175 | 175 | ||
176 | -$pm->addBatch(10,function (){ | 176 | +$pm->addBatch(1,function (){ |
177 | 177 | ||
178 | swoole_set_process_name('hot-email-run'); | 178 | swoole_set_process_name('hot-email-run'); |
179 | 179 | ||
@@ -181,7 +181,7 @@ $pm->addBatch(10,function (){ | @@ -181,7 +181,7 @@ $pm->addBatch(10,function (){ | ||
181 | 181 | ||
182 | new HotMail(); | 182 | new HotMail(); |
183 | // 执行完了暂停5分钟在执行 | 183 | // 执行完了暂停5分钟在执行 |
184 | - sleep(300); | 184 | + sleep(120); |
185 | },true); | 185 | },true); |
186 | 186 | ||
187 | $pm->start(); | 187 | $pm->start(); |
-
请 注册 或 登录 后发表评论