mirror of
https://github.com/danog/TelegramApiServer.git
synced 2024-11-30 04:19:13 +01:00
Add mutex
This commit is contained in:
parent
561fec0a12
commit
40d16c372a
@ -52,6 +52,7 @@ class Client
|
||||
|
||||
public function addSession(string $session, array $settings = []): API
|
||||
{
|
||||
$this->mutex ??= new LocalKeyedMutex;
|
||||
$lock = $this->mutex->acquire($session);
|
||||
if (isset($this->instances[$session])) {
|
||||
throw new InvalidArgumentException('Session already exists');
|
||||
|
Loading…
Reference in New Issue
Block a user