From 11a34fbdc1589e3c1a1d5fa3e197406deae9b271 Mon Sep 17 00:00:00 2001 From: Embbnux Ji Date: Thu, 12 Oct 2023 14:48:46 +0800 Subject: [PATCH] fix: undefined issue at discovery retry cycle (#221) * fix: undefined at discovery retry cycle * fix: use default value when retryCycleDelay no value --- sdk/src/platform/Discovery.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/src/platform/Discovery.ts b/sdk/src/platform/Discovery.ts index 5a4be0b..c25fa6c 100644 --- a/sdk/src/platform/Discovery.ts +++ b/sdk/src/platform/Discovery.ts @@ -298,13 +298,14 @@ export default class Discovery extends EventEmitter { try { await this.fetchExternalData(externalEndpoint); } catch (e) { + const retryCycleDelay = oldExternalData ? oldExternalData.retryCycleDelay : 824; this._externalRetryCycleTimeout = setTimeout(() => { this._externalRetryCycleTimeout = null; this._refreshExternalData(); - }, oldExternalData.retryCycleDelay * 1000); + }, retryCycleDelay * 1000); this.emit(events.externalRefreshError, { error: e, - message: `Fetch External Discovery data error, will retry after ${oldExternalData.retryCycleDelay}s.`, + message: `Fetch External Discovery data error, will retry after ${retryCycleDelay}s.`, }); } }