mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 03:37:44 +08:00
Optimized amqp consumer which can stop safely. (#2662)
Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
parent
27c5ce7837
commit
20710a40e5
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
## Optimized
|
## Optimized
|
||||||
|
|
||||||
|
- [#2662](https://github.com/hyperf/hyperf/pull/2662) Optimized amqp consumer which can stop safely.
|
||||||
- [#2690](https://github.com/hyperf/hyperf/pull/2690) Optimized `tracer` which ensure span finished and flushed.
|
- [#2690](https://github.com/hyperf/hyperf/pull/2690) Optimized `tracer` which ensure span finished and flushed.
|
||||||
|
|
||||||
# v2.0.15 - 2020-10-19
|
# v2.0.15 - 2020-10-19
|
||||||
|
@ -21,6 +21,7 @@ use Hyperf\Amqp\Message\MessageInterface;
|
|||||||
use Hyperf\Amqp\Pool\PoolFactory;
|
use Hyperf\Amqp\Pool\PoolFactory;
|
||||||
use Hyperf\Contract\ConfigInterface;
|
use Hyperf\Contract\ConfigInterface;
|
||||||
use Hyperf\ExceptionHandler\Formatter\FormatterInterface;
|
use Hyperf\ExceptionHandler\Formatter\FormatterInterface;
|
||||||
|
use Hyperf\Process\ProcessManager;
|
||||||
use Hyperf\Utils\Coroutine\Concurrent;
|
use Hyperf\Utils\Coroutine\Concurrent;
|
||||||
use PhpAmqpLib\Channel\AMQPChannel;
|
use PhpAmqpLib\Channel\AMQPChannel;
|
||||||
use PhpAmqpLib\Message\AMQPMessage;
|
use PhpAmqpLib\Message\AMQPMessage;
|
||||||
@ -92,7 +93,7 @@ class Consumer extends Builder
|
|||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
while ($channel->is_consuming()) {
|
while ($channel->is_consuming() && ProcessManager::isRunning()) {
|
||||||
$channel->wait();
|
$channel->wait();
|
||||||
}
|
}
|
||||||
} catch (MaxConsumptionException $ex) {
|
} catch (MaxConsumptionException $ex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user