From 7c68fa0165ad8ffc2ecdb2d369593ed9df23c5f1 Mon Sep 17 00:00:00 2001 From: wivwiv Date: Tue, 9 May 2023 15:55:48 +0800 Subject: [PATCH] fix(simulate): fix the bug that the multi pub config does not load correctly --- cli/src/lib/pub.ts | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/cli/src/lib/pub.ts b/cli/src/lib/pub.ts index 38b9545fe7..e05918d3dc 100644 --- a/cli/src/lib/pub.ts +++ b/cli/src/lib/pub.ts @@ -126,19 +126,7 @@ const multiPub = async ( commandType: CommandType, message?: string | Buffer, ) => { - const { - save, - config, - count, - interval, - messageInterval, - hostname, - port, - topic, - clientId, - verbose, - maximumReconnectTimes, - } = options + const { save, config } = options let simulator: Simulator = {} as Simulator if (commandType === 'simulate') { @@ -148,15 +136,15 @@ const multiPub = async ( const simulateOptions = options as SimulatePubOptions checkScenarioExists(simulateOptions.scenario, simulateOptions.file) simulator = loadSimulator(simulateOptions.scenario, simulateOptions.file) - - checkTopicExists(topic, 'simulate') } else { options = config ? loadConfig('benchPub', config) : options save && saveConfig('benchPub', options) - - checkTopicExists(topic, 'benchPub') } + const { count, interval, messageInterval, hostname, port, topic, clientId, verbose, maximumReconnectTimes } = options + + checkTopicExists(topic, commandType) + const connOpts = parseConnectOptions(options, 'pub') const pubOpts = parsePublishOptions(options)