fix(auth): move redlock settings

This commit is contained in:
Gergő Móricz 2024-09-25 22:27:51 +02:00
parent 81245e68fa
commit 250c3bb5c6
2 changed files with 4 additions and 10 deletions

View File

@ -43,10 +43,7 @@ export async function setCachedACUC(api_key: string, acuc: AuthCreditUsageChunk
const lockTTL = 10000; // 10 seconds
try {
const lock = await redlock.acquire([redLockKey], lockTTL, {
retryCount: 200,
retryDelay: 100,
});
const lock = await redlock.acquire([redLockKey], lockTTL);
try {
if (typeof acuc === "function") {

View File

@ -10,12 +10,9 @@ export const redlock = new Redlock(
// http://redis.io/topics/distlock
driftFactor: 0.01, // multiplied by lock ttl to determine drift time
// The max number of times Redlock will attempt to lock a resource
// before erroring.
retryCount: 5,
// the time in ms between attempts
retryDelay: 100, // time in ms
retryCount: 200,
retryDelay: 100,
// the max time in ms randomly added to retries
// to improve performance under high contention