mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-07-31 00:22:00 +08:00
fix: remove invalid cache lru
This commit is contained in:
parent
0cf4a9ede1
commit
b6ac1782dc
@ -18,17 +18,8 @@ import envConfig from '../shared/services/secrets';
|
||||
import { JinaEmbeddingsDashboardHTTP } from '../shared/3rd-party/jina-embeddings';
|
||||
import { JinaEmbeddingsTokenAccount } from '../shared/db/jina-embeddings-token-account';
|
||||
|
||||
import { LRUCache } from 'lru-cache';
|
||||
|
||||
const authDtoLogger = logger.child({ service: 'JinaAuthDTO' });
|
||||
|
||||
const invalidTokenLRU = new LRUCache({
|
||||
max: 256,
|
||||
ttl: 60 * 60 * 1000,
|
||||
updateAgeOnGet: false,
|
||||
updateAgeOnHas: false,
|
||||
});
|
||||
|
||||
|
||||
const THE_VERY_SAME_JINA_EMBEDDINGS_CLIENT = new JinaEmbeddingsDashboardHTTP(envConfig.JINA_EMBEDDINGS_DASHBOARD_API_KEY);
|
||||
|
||||
@ -91,12 +82,6 @@ export class JinaEmbeddingsAuthDTO extends AutoCastable {
|
||||
});
|
||||
}
|
||||
|
||||
if (invalidTokenLRU.get(this.bearerToken)) {
|
||||
throw new AuthenticationFailedError({
|
||||
message: 'Invalid API key, please get a new one from https://jina.ai'
|
||||
});
|
||||
}
|
||||
|
||||
let firestoreDegradation = false;
|
||||
let account;
|
||||
try {
|
||||
@ -165,7 +150,6 @@ export class JinaEmbeddingsAuthDTO extends AutoCastable {
|
||||
authDtoLogger.warn(`Failed to get user brief: ${err}`, { err: marshalErrorLike(err) });
|
||||
|
||||
if (err?.status === 401) {
|
||||
invalidTokenLRU.set(this.bearerToken, true);
|
||||
throw new AuthenticationFailedError({
|
||||
message: 'Invalid API key, please get a new one from https://jina.ai'
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user