Skip to content

Commit

Permalink
Merge branch 'master' into npai/remove-v3
Browse files Browse the repository at this point in the history
  • Loading branch information
pxrl authored Mar 26, 2024
2 parents b7edae8 + 286fefb commit 9536efc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/clients/AcrossAPIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ export class AcrossApiClient {
}
if (redis) {
// Cache limit for 5 minutes.
await redis.set(this.getLimitsCacheKey(l1Token, destinationChainId), result.data.maxDeposit.toString(), 300);
const baseTtl = 300;
// Apply a random margin to spread expiry over a larger time window.
const ttl = baseTtl + Math.ceil(_.random(-0.5, 0.5, true) * baseTtl);
await redis.set(this.getLimitsCacheKey(l1Token, destinationChainId), result.data.maxDeposit.toString(), ttl);
}
return result.data;
} catch (err) {
Expand Down

0 comments on commit 9536efc

Please sign in to comment.