mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
Optimized code of concurrent to adapt hyperf engine. (#2742)
This commit is contained in:
parent
5cab34c07b
commit
2e7a349b51
@ -20,6 +20,7 @@
|
||||
- Removed config `rate-limit.php`, please use `rate_limit.php` instead.
|
||||
- Removed useless class `Hyperf\Resource\Response\ResponseEmitter`.
|
||||
- Removed component `hyperf/paginator` from database's dependencies.
|
||||
- Removed method `stats` from `Hyperf\Utils\Coroutine\Concurrent`.
|
||||
|
||||
## Changed
|
||||
|
||||
|
@ -12,16 +12,14 @@ declare(strict_types=1);
|
||||
namespace Hyperf\Utils\Coroutine;
|
||||
|
||||
use Hyperf\Contract\StdoutLoggerInterface;
|
||||
use Hyperf\Engine\Channel;
|
||||
use Hyperf\ExceptionHandler\Formatter\FormatterInterface;
|
||||
use Hyperf\Utils\ApplicationContext;
|
||||
use Swoole\Coroutine;
|
||||
use Swoole\Coroutine\Channel;
|
||||
use Hyperf\Utils\Coroutine;
|
||||
|
||||
/**
|
||||
* @method bool isFull()
|
||||
* @method bool isEmpty()
|
||||
* @method array stats()
|
||||
* @method int length()
|
||||
*/
|
||||
class Concurrent
|
||||
{
|
||||
@ -43,7 +41,7 @@ class Concurrent
|
||||
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
if (in_array($name, ['isFull', 'isEmpty', 'length', 'stats'])) {
|
||||
if (in_array($name, ['isFull', 'isEmpty'])) {
|
||||
return $this->channel->{$name}(...$arguments);
|
||||
}
|
||||
}
|
||||
@ -53,9 +51,14 @@ class Concurrent
|
||||
return $this->limit;
|
||||
}
|
||||
|
||||
public function length(): int
|
||||
{
|
||||
return $this->channel->getLength();
|
||||
}
|
||||
|
||||
public function getLength(): int
|
||||
{
|
||||
return $this->channel->length();
|
||||
return $this->channel->getLength();
|
||||
}
|
||||
|
||||
public function getRunningCoroutineCount(): int
|
||||
|
Loading…
Reference in New Issue
Block a user