Skip to content

Commit da1181a

Browse files
committed
fix: client sdk should log an error when identify times out
1 parent 2afbc19 commit da1181a

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/sdk/browser/src/BrowserClient.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,7 @@ class BrowserClientImpl extends LDClientImpl {
237237
identifyOptionsWithUpdatedDefaults.sheddable = true;
238238
}
239239

240-
const res = await super.identify(
241-
context,
242-
identifyOptionsWithUpdatedDefaults,
243-
)
240+
const res = await super.identify(context, identifyOptionsWithUpdatedDefaults);
244241

245242
this._goalManager?.startTracking();
246243
return res;

packages/shared/sdk-client/src/LDClientImpl.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,14 @@ export default class LDClientImpl implements LDClient {
379379
resolve({ status: 'timeout', timeout: identifyTimeout } as LDIdentifyTimeout);
380380
}, identifyTimeout * 1000);
381381
});
382-
return Promise.race([callSitePromise, timeoutPromise]);
382+
383+
return Promise.race([callSitePromise, timeoutPromise]).then((result: LDIdentifyResult) => {
384+
if (result.status === 'timeout') {
385+
this.logger?.error(`identify timed out after ${identifyTimeout} seconds.`);
386+
}
387+
388+
return result;
389+
});
383390
}
384391

385392
/**

0 commit comments

Comments
 (0)