Skip to content

Commit e435dbc

Browse files
committed
Display warning only once
1 parent 8ac4717 commit e435dbc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dev-packages/ovsx-client/src/ovsx-http-client.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,18 @@ export class OVSXHttpClient implements OVSXClient {
4848

4949
protected async requestJson<R>(url: string): Promise<R> {
5050
const attempts = 5;
51+
let warn = true;
5152
for (let i = 0; i < attempts; i++) {
5253
await this.rateLimiter.removeTokens(i + 1);
5354
const context = await this.requestService.request({
5455
url,
5556
headers: { 'Accept': 'application/json' }
5657
});
5758
if (context.res.statusCode === 429) {
58-
console.warn('OVSX rate limit exceeded. Will perform request with higher timeout. Consider reducing the rate limit.');
59+
if (warn) {
60+
warn = false;
61+
console.warn('OVSX rate limit exceeded. Will perform request with higher timeout. Consider reducing the rate limit.');
62+
}
5963
if (i < attempts - 1) {
6064
continue;
6165
}

0 commit comments

Comments
 (0)