From 083c933ad38a33cca979dc58c5be5ae3ca6ab5e8 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 26 Jun 2024 22:39:31 +0200 Subject: [PATCH] Add mutex --- src/Client.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Client.php b/src/Client.php index 06b9fbf..62f7c33 100644 --- a/src/Client.php +++ b/src/Client.php @@ -48,12 +48,12 @@ class Client ); } - private LocalKeyedMutex $mutex; + private static LocalKeyedMutex $mutex; public function addSession(string $session, array $settings = []): API { - $this->mutex ??= new LocalKeyedMutex; - $lock = $this->mutex->acquire($session); + self::$mutex ??= new LocalKeyedMutex; + $lock = self::$mutex->acquire($session); if (isset($this->instances[$session])) { throw new InvalidArgumentException('Session already exists'); }