File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
packages/shared/sdk-server/src Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 11/* eslint-disable class-methods-use-this */
22import {
3+ cancelableTimedPromise ,
34 ClientContext ,
45 Context ,
56 internal ,
@@ -11,7 +12,6 @@ import {
1112 LDTimeoutError ,
1213 Platform ,
1314 subsystem ,
14- timedPromise ,
1515 TypeValidators ,
1616} from '@launchdarkly/js-sdk-common' ;
1717
@@ -911,8 +911,11 @@ export default class LDClientImpl implements LDClient {
911911 logger ?: LDLogger ,
912912 ) : Promise < LDClient > {
913913 if ( timeout ) {
914- const timeoutPromise = timedPromise ( timeout , 'waitForInitialization' ) ;
915- return Promise . race ( [ basePromise , timeoutPromise . then ( ( ) => this ) ] ) . catch ( ( reason ) => {
914+ const cancelableTimeout = cancelableTimedPromise ( timeout , 'waitForInitialization' ) ;
915+ return Promise . race ( [
916+ basePromise . then ( ( ) => cancelableTimeout . cancel ( ) ) . then ( ( ) => this ) ,
917+ cancelableTimeout . promise . then ( ( ) => this ) ,
918+ ] ) . catch ( ( reason ) => {
916919 if ( reason instanceof LDTimeoutError ) {
917920 logger ?. error ( reason . message ) ;
918921 }
You can’t perform that action at this time.
0 commit comments