-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Labels
Description
Describe the bug
on the node 7.0 sdk, on an org with a concurrent rate limit of 75, this code will return the first 75-ish immediately, but then wait for a long time (like 2 minutes) to return the last 4-5.
it shouldn't, of course, but the rate limit headers tell it to, and so it does. it's more of an api bug, but the sdk can ignore the bad headers and "do the right thing"
import okta from '@okta/okta-sdk-nodejs';
const client = new okta.Client();
client.requestExecutor.on('backoff', (_request, response, _requestId, delayMs) => {
console.log('Backoff', delayMs, 'ms', response.headers.get('X-Rate-Limit-limit'),
response.headers.get('X-Rate-Limit-reset'), response.headers.get('X-Rate-Limit-remaining'));
}).on('resume', (_request, _requestId) => {
console.log('Resume');
});
for (let i = 0; i < 80; i++) {
getUser(i); // no await, run these in parallel
}
async function getUser(i) {
const user = await client.userApi.getUser({userId: '00u...'});
console.log(i, user.profile.login, new Date);
}output (snippet)
56 gabrielsroka@gsroka.local 2024-02-10T18:52:14.808Z ok
54 gabrielsroka@gsroka.local 2024-02-10T18:52:14.810Z ok
Backoff 132000 ms 0 1707592826 0
Backoff 109000 ms 0 1707592803 0
Resume
Resume
76 gabrielsroka@gsroka.local 2024-02-10T18:54:01.288Z why wait so long?
53 gabrielsroka@gsroka.local 2024-02-10T18:54:07.171Z
63 gabrielsroka@gsroka.local 2024-02-10T18:54:23.157Z
58 gabrielsroka@gsroka.local 2024-02-10T18:54:30.144Z
Reproduction Steps?
see above
SDK Versions
7.0
Additional Information
No response
Reactions are currently unavailable