Skip to content

Commit

Permalink
fix: undefined issue at discovery retry cycle (ringcentral#221)
Browse files Browse the repository at this point in the history
* fix: undefined at discovery retry cycle

* fix: use default value when retryCycleDelay no value
  • Loading branch information
embbnux authored Oct 12, 2023
1 parent 0fe73e5 commit 11a34fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sdk/src/platform/Discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`,
});
}
}
Expand Down

0 comments on commit 11a34fb

Please sign in to comment.