Skip to content

Commit 3c97715

Browse files
committed
修复配置了 QueueConsumer 但没配置队列时,消费进程频繁退出重新运行
1 parent 484cf58 commit 3c97715

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/Process/SwooleQueueConsumerProcess.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Imi\Aop\Annotation\Inject;
88
use Imi\App;
9+
use Imi\Log\Log;
910
use Imi\Queue\Service\QueueService;
1011
use Imi\Swoole\Process\Annotation\Process;
1112
use Imi\Swoole\Process\BaseProcess;
@@ -84,6 +85,14 @@ public function run(\Swoole\Process $process): void
8485
});
8586
$processPool->start();
8687
}
88+
if (!isset($name))
89+
{
90+
Log::warning('@app.beans.imiQueue.list is empty');
91+
while (true)
92+
{
93+
sleep(86400);
94+
}
95+
}
8796
Event::wait();
8897
}
8998
}

src/Process/WorkermanQueueConsumerProcess.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Imi\Queue\Process;
66

77
use Imi\Aop\Annotation\Inject;
8+
use Imi\Log\Log;
89
use Imi\Queue\Service\QueueService;
910
use Imi\Workerman\Process\Annotation\Process;
1011
use Imi\Workerman\Process\BaseProcess;
@@ -48,6 +49,14 @@ public function run(Worker $worker): void
4849
}
4950

5051
WorkermanServerWorker::runAll();
52+
if (!isset($name))
53+
{
54+
Log::warning('@app.beans.imiQueue.list is empty');
55+
while (true)
56+
{
57+
sleep(86400);
58+
}
59+
}
5160
}
5261
}
5362
}

0 commit comments

Comments
 (0)