Skip to content

Commit 7fc4f2f

Browse files
authored
fix: Adjust identify timeout message. (#447)
Make the message more actionable.
1 parent fd45ea3 commit 7fc4f2f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ describe('sdk-client identify timeout', () => {
121121
await ldc.identify(carContext, { timeout: customTimeout });
122122

123123
expect(ldc.identifyTimeout).toEqual(10);
124-
expect(logger.warn).not.toHaveBeenCalledWith(expect.stringMatching(/high timeout/));
124+
expect(logger.warn).not.toHaveBeenCalledWith(expect.stringMatching(/timeout greater/));
125125
});
126126

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

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

134-
expect(logger.warn).toHaveBeenCalledWith(expect.stringMatching(/high timeout/));
134+
expect(logger.warn).toHaveBeenCalledWith(expect.stringMatching(/timeout greater/));
135135
});
136136

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

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

145-
expect(logger.warn).not.toHaveBeenCalledWith(expect.stringMatching(/high timeout/));
145+
expect(logger.warn).not.toHaveBeenCalledWith(expect.stringMatching(/timeout greater/));
146146
});
147147
});

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,11 @@ export default class LDClientImpl implements LDClient {
292292
}
293293

294294
if (this.identifyTimeout > this.highTimeoutThreshold) {
295-
this.logger.warn('identify called with high timeout parameter.');
295+
this.logger.warn(
296+
'The identify function was called with a timeout greater than' +
297+
`${this.highTimeoutThreshold} seconds. We recommend a timeout of less than` +
298+
`${this.highTimeoutThreshold} seconds.`,
299+
);
296300
}
297301

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

0 commit comments

Comments
 (0)