mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-04-19 04:10:08 +08:00
fix: add jitter to user cache
This commit is contained in:
parent
988413dc6b
commit
f3b82a4d50
@ -105,10 +105,11 @@ export class JinaEmbeddingsAuthDTO extends AutoCastable {
|
||||
}
|
||||
|
||||
|
||||
const age = account?.lastSyncedAt ? Date.now() - account.lastSyncedAt.getTime() : Infinity;
|
||||
const age = account?.lastSyncedAt ? Date.now() - account.lastSyncedAt.valueOf() : Infinity;
|
||||
const jitter = Math.ceil(Math.random() * 30 * 1000);
|
||||
|
||||
if (account && !ignoreCache) {
|
||||
if (account && age < 180_000) {
|
||||
if (account && age < (180_000 - jitter)) {
|
||||
this.user = account;
|
||||
this.uid = this.user?.user_id;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user