Moved $serverId to local channel manager
This commit is contained in:
parent
01e3b67280
commit
aebc38ff8e
|
|
@ -53,6 +53,13 @@ class LocalChannelManager implements ChannelManager
|
||||||
*/
|
*/
|
||||||
protected $store;
|
protected $store;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unique server identifier.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $serverId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The lock name to use on Array to avoid multiple
|
* The lock name to use on Array to avoid multiple
|
||||||
* actions that might lead to multiple processings.
|
* actions that might lead to multiple processings.
|
||||||
|
|
@ -71,6 +78,7 @@ class LocalChannelManager implements ChannelManager
|
||||||
public function __construct(LoopInterface $loop, $factoryClass = null)
|
public function __construct(LoopInterface $loop, $factoryClass = null)
|
||||||
{
|
{
|
||||||
$this->store = new ArrayStore;
|
$this->store = new ArrayStore;
|
||||||
|
$this->serverId = Str::uuid()->toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -509,6 +517,16 @@ class LocalChannelManager implements ChannelManager
|
||||||
return Channel::class;
|
return Channel::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the unique identifier for the server.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getServerId(): string
|
||||||
|
{
|
||||||
|
return $this->serverId;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a new ArrayLock instance to avoid race conditions.
|
* Get a new ArrayLock instance to avoid race conditions.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,6 @@ class RedisChannelManager extends LocalChannelManager
|
||||||
*/
|
*/
|
||||||
protected $loop;
|
protected $loop;
|
||||||
|
|
||||||
/**
|
|
||||||
* The unique server identifier.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $serverId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The pub client.
|
* The pub client.
|
||||||
*
|
*
|
||||||
|
|
@ -71,6 +64,8 @@ class RedisChannelManager extends LocalChannelManager
|
||||||
*/
|
*/
|
||||||
public function __construct(LoopInterface $loop, $factoryClass = null)
|
public function __construct(LoopInterface $loop, $factoryClass = null)
|
||||||
{
|
{
|
||||||
|
parent::construct($loop, $factoryClass);
|
||||||
|
|
||||||
$this->loop = $loop;
|
$this->loop = $loop;
|
||||||
|
|
||||||
$this->redis = Redis::connection(
|
$this->redis = Redis::connection(
|
||||||
|
|
@ -88,8 +83,6 @@ class RedisChannelManager extends LocalChannelManager
|
||||||
$this->subscribeClient->on('message', function ($channel, $payload) {
|
$this->subscribeClient->on('message', function ($channel, $payload) {
|
||||||
$this->onMessage($channel, $payload);
|
$this->onMessage($channel, $payload);
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->serverId = Str::uuid()->toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -538,16 +531,6 @@ class RedisChannelManager extends LocalChannelManager
|
||||||
return $this->getPublishClient();
|
return $this->getPublishClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the unique identifier for the server.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getServerId(): string
|
|
||||||
{
|
|
||||||
return $this->serverId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Increment the subscribed count number.
|
* Increment the subscribed count number.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue