From 992bf37dc16cb6522955f355d51921e80c84d6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Sun, 3 Nov 2024 09:34:52 +0800 Subject: [PATCH] Fixed socket already open issue --- redisclient.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/redisclient.js b/redisclient.js index fcea483..fab471e 100644 --- a/redisclient.js +++ b/redisclient.js @@ -12,15 +12,20 @@ class ClientCompat this.client = Redis.createClient({ "url": `redis://${SessConf.config.host}:${SessConf.config.port}/${SessConf.config.database}` }); + + this.connecting = false; } _nop() { } async _connect() { - if( this.client.isReady ) + if( this.client.isReady || this.connecting ) return; + + this.connecting = true; await this.client.connect(); + this.connecting = false; } async GET( key, handler )