mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-14 01:16:17 +02:00
chore: remove unnecessary logs (#6909)
This commit is contained in:
parent
3e4ed38e2b
commit
61a689ccc7
@ -108,9 +108,6 @@ export class ApiTokenService {
|
|||||||
async fetchActiveTokens(): Promise<void> {
|
async fetchActiveTokens(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
this.activeTokens = await this.store.getAllActive();
|
this.activeTokens = await this.store.getAllActive();
|
||||||
this.logger.info(
|
|
||||||
`Fetched active tokens from store, size: ${this.activeTokens.length}`,
|
|
||||||
);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.warn('Failed to fetch active tokens', e);
|
this.logger.warn('Failed to fetch active tokens', e);
|
||||||
}
|
}
|
||||||
@ -125,9 +122,6 @@ export class ApiTokenService {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.info(
|
|
||||||
`Checking for token in cache of size: ${this.activeTokens.length}`,
|
|
||||||
);
|
|
||||||
let token = this.activeTokens.find(
|
let token = this.activeTokens.find(
|
||||||
(activeToken) =>
|
(activeToken) =>
|
||||||
Boolean(activeToken.secret) &&
|
Boolean(activeToken.secret) &&
|
||||||
@ -147,12 +141,8 @@ export class ApiTokenService {
|
|||||||
const nextAllowedQuery = this.queryAfter.get(secret) ?? 0;
|
const nextAllowedQuery = this.queryAfter.get(secret) ?? 0;
|
||||||
if (!token) {
|
if (!token) {
|
||||||
if (isPast(nextAllowedQuery)) {
|
if (isPast(nextAllowedQuery)) {
|
||||||
this.logger.info(`Token not found in cache, querying database`);
|
|
||||||
if (this.queryAfter.size > 1000) {
|
if (this.queryAfter.size > 1000) {
|
||||||
// establish a max limit for queryAfter size to prevent memory leak
|
// establish a max limit for queryAfter size to prevent memory leak
|
||||||
this.logger.info(
|
|
||||||
'queryAfter size exceeded 1000, clearing cache',
|
|
||||||
);
|
|
||||||
this.queryAfter.clear();
|
this.queryAfter.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +208,6 @@ export class ApiTokenService {
|
|||||||
secret: string,
|
secret: string,
|
||||||
): Promise<IApiUser | undefined> {
|
): Promise<IApiUser | undefined> {
|
||||||
const token = await this.getTokenWithCache(secret);
|
const token = await this.getTokenWithCache(secret);
|
||||||
this.logger.info(`Found user? ${token ? 'yes' : 'no'}`);
|
|
||||||
if (token) {
|
if (token) {
|
||||||
this.lastSeenSecrets.add(token.secret);
|
this.lastSeenSecrets.add(token.secret);
|
||||||
const apiUser: IApiUser = new ApiUser({
|
const apiUser: IApiUser = new ApiUser({
|
||||||
|
Loading…
Reference in New Issue
Block a user