根据在线人数路由

This commit is contained in:
luying
2022-08-12 09:39:56 +08:00
parent 3e2c408645
commit 1313f0777f
7 changed files with 143 additions and 15 deletions
+9
View File
@@ -575,6 +575,15 @@ export async function checkConnectors() {
}
}
export async function incConnectorNum(sid: string, inc: number) {
let server = await redisClient().hgetAsync(REDIS_KEY.SYS_SERVER, sid);
let json = JSON.parse(server);
let { id, serverType, clientHost, clientPort, num = 0 } = json;
let newNum = num + inc;
if(newNum < 0) newNum = 0;
await redisClient().hsetAsync(REDIS_KEY.SYS_SERVER, id, JSON.stringify({ serverType, clientHost, clientPort, id, num: num + inc }));
}
/*************** 将connector服插入redis *******/