Skip to content

Commit

Permalink
fix: Adjust identify timeout message. (#447)
Browse files Browse the repository at this point in the history
Make the message more actionable.
  • Loading branch information
kinyoklion authored Apr 25, 2024
1 parent fd45ea3 commit 7fc4f2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/shared/sdk-client/src/LDClientImpl.timeout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('sdk-client identify timeout', () => {
await ldc.identify(carContext, { timeout: customTimeout });

expect(ldc.identifyTimeout).toEqual(10);
expect(logger.warn).not.toHaveBeenCalledWith(expect.stringMatching(/high timeout/));
expect(logger.warn).not.toHaveBeenCalledWith(expect.stringMatching(/timeout greater/));
});

test('warning when timeout is too high', async () => {
Expand All @@ -131,7 +131,7 @@ describe('sdk-client identify timeout', () => {

await ldc.identify(carContext, { timeout: highTimeout });

expect(logger.warn).toHaveBeenCalledWith(expect.stringMatching(/high timeout/));
expect(logger.warn).toHaveBeenCalledWith(expect.stringMatching(/timeout greater/));
});

test('safe timeout should not warn', async () => {
Expand All @@ -142,6 +142,6 @@ describe('sdk-client identify timeout', () => {

await ldc.identify(carContext, { timeout: safeTimeout });

expect(logger.warn).not.toHaveBeenCalledWith(expect.stringMatching(/high timeout/));
expect(logger.warn).not.toHaveBeenCalledWith(expect.stringMatching(/timeout greater/));
});
});
6 changes: 5 additions & 1 deletion packages/shared/sdk-client/src/LDClientImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,11 @@ export default class LDClientImpl implements LDClient {
}

if (this.identifyTimeout > this.highTimeoutThreshold) {
this.logger.warn('identify called with high timeout parameter.');
this.logger.warn(
'The identify function was called with a timeout greater than' +
`${this.highTimeoutThreshold} seconds. We recommend a timeout of less than` +
`${this.highTimeoutThreshold} seconds.`,
);
}

let context = await ensureKey(pristineContext, this.platform);
Expand Down

0 comments on commit 7fc4f2f

Please sign in to comment.