diff --git a/src/utils/system.util.ts b/src/utils/system.util.ts index 8d5dcbb..f742a3f 100644 --- a/src/utils/system.util.ts +++ b/src/utils/system.util.ts @@ -5,6 +5,7 @@ const signals: NodeJS.Signals[] = ['SIGINT', 'SIGTERM', 'SIGUSR2'] const NODES_SET = 'poker:infosvr' const discovery_channel = 'poker:infosvr:discovery' +const isProd = process.env.NODE_ENV === 'production' export function registerGracefulShutdown(callback: (err?: Error) => void) { /** @@ -26,6 +27,9 @@ async function getNodeAddress(port: number) { } export async function registService(port: number) { + if (!isProd) { + return + } const address = await getNodeAddress(port) const client = new RedisClient() await client.sadd(NODES_SET, address) @@ -33,6 +37,9 @@ export async function registService(port: number) { } export async function unRegistService(port: number) { + if (!isProd) { + return + } const address = await getNodeAddress(port) const client = new RedisClient() await client.srem(NODES_SET, address)