1
0
mirror of https://github.com/Unleash/unleash.git synced 2026-02-04 20:10:52 +01:00

chore: token rate-limit sampling

This commit is contained in:
Saulius Astromskis 2025-12-18 10:05:56 +01:00
parent 25c10658c1
commit b4acd68283
No known key found for this signature in database

View File

@ -170,18 +170,14 @@ export class ApiTokenService {
}
stopCacheTimer();
} else {
this.logger.debug(
`Token ${secret.replace(
/^([^.]*)\.(.{8}).*$/,
'$1.$2...',
)} rate limited until: ${this.queryAfter.get(secret)}`,
if (Math.random() < 0.1) {
this.logger.debug(
`Token ${secret.replace(
/^([^.]*)\.(.{8}).*$/,
'$1.$2...',
)} rate limited until: ${this.queryAfter.get(secret)}`,
}
if (Math.random() < 0.1) {
this.logger.info(
`Token ${secret.replace(
/^([^.]*)\.(.{8}).*$/,
'$1.$2...',
)} rate limited until: ${this.queryAfter.get(secret)}`,
);
}
}
}
return token;