mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
Fixed collect more than once time when using watcher. (#2242)
This commit is contained in:
parent
50cd5ebfe6
commit
1bd2446a76
@ -3,6 +3,7 @@
|
||||
## Fixed
|
||||
|
||||
- [#2236](https://github.com/hyperf/hyperf/pull/2236) Fixed bug that select node failed when using `loadBalancer` for nacos.
|
||||
- [#2242](https://github.com/hyperf/hyperf/pull/2242) Fixed bug that collect more than once time when using watcher.
|
||||
|
||||
# v2.0.5 - 2020-08-03
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
||||
"overtrue/flysystem-qiniu": "^1.0",
|
||||
"php-amqplib/php-amqplib": "^2.7",
|
||||
"php-di/php-di": "^6.0",
|
||||
"phpstan/phpstan": "^0.12",
|
||||
"phpstan/phpstan": "0.12.34",
|
||||
"phpunit/phpunit": "^7.0.0",
|
||||
"predis/predis": "^1.1",
|
||||
"reactivex/rxphp": "^2.0",
|
||||
|
@ -29,6 +29,19 @@ class SocketIORouter extends MetadataCollector
|
||||
static::set('backward.' . $className, $nsp);
|
||||
}
|
||||
|
||||
public static function clear(string $key = null): void
|
||||
{
|
||||
if ($key !== null) {
|
||||
parent::clear('backward.' . $key);
|
||||
foreach (static::$container['forward'] ?? [] as $nsp => $value) {
|
||||
if ($value == $key) {
|
||||
unset(static::$container['forward'][$nsp]);
|
||||
}
|
||||
}
|
||||
}
|
||||
parent::clear($key);
|
||||
}
|
||||
|
||||
public static function getNamespace(string $className)
|
||||
{
|
||||
return static::get('backward.' . $className, '/');
|
||||
|
@ -94,6 +94,9 @@ class Process
|
||||
// Collect the annotations.
|
||||
$ref = $this->reflection->classReflector()->reflect($class);
|
||||
BetterReflectionManager::reflectClass($class, $ref);
|
||||
foreach ($collectors as $collector) {
|
||||
$collector::clear($class);
|
||||
}
|
||||
$this->collect($class, $ref);
|
||||
|
||||
$collectors = $this->config->getCollectors();
|
||||
|
Loading…
Reference in New Issue
Block a user