Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unnecessary logs #6909

Merged
merged 5 commits into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/lib/services/api-token-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ export class ApiTokenService {
async fetchActiveTokens(): Promise<void> {
try {
this.activeTokens = await this.store.getAllActive();
this.logger.info(
`Fetched active tokens from store, size: ${this.activeTokens.length}`,
);
} catch (e) {
this.logger.warn('Failed to fetch active tokens', e);
}
Expand All @@ -125,9 +122,6 @@ export class ApiTokenService {
return undefined;
}

this.logger.info(
`Checking for token in cache of size: ${this.activeTokens.length}`,
);
let token = this.activeTokens.find(
(activeToken) =>
Boolean(activeToken.secret) &&
Expand All @@ -147,12 +141,8 @@ export class ApiTokenService {
const nextAllowedQuery = this.queryAfter.get(secret) ?? 0;
if (!token) {
if (isPast(nextAllowedQuery)) {
this.logger.info(`Token not found in cache, querying database`);
if (this.queryAfter.size > 1000) {
// establish a max limit for queryAfter size to prevent memory leak
this.logger.info(
'queryAfter size exceeded 1000, clearing cache',
);
this.queryAfter.clear();
}

Expand Down Expand Up @@ -218,7 +208,6 @@ export class ApiTokenService {
secret: string,
): Promise<IApiUser | undefined> {
const token = await this.getTokenWithCache(secret);
this.logger.info(`Found user? ${token ? 'yes' : 'no'}`);
if (token) {
this.lastSeenSecrets.add(token.secret);
const apiUser: IApiUser = new ApiUser({
Expand Down
Loading