Fixed socket already open issue

This commit is contained in:
斟酌 鵬兄 2024-11-03 09:34:52 +08:00
parent 6f9fd7b88c
commit 992bf37dc1

View File

@ -12,15 +12,20 @@ class ClientCompat
this.client = Redis.createClient({ this.client = Redis.createClient({
"url": `redis://${SessConf.config.host}:${SessConf.config.port}/${SessConf.config.database}` "url": `redis://${SessConf.config.host}:${SessConf.config.port}/${SessConf.config.database}`
}); });
this.connecting = false;
} }
_nop() { } _nop() { }
async _connect() async _connect()
{ {
if( this.client.isReady ) if( this.client.isReady || this.connecting )
return; return;
this.connecting = true;
await this.client.connect(); await this.client.connect();
this.connecting = false;
} }
async GET( key, handler ) async GET( key, handler )