fix rate limit scaling (it's no longer inverted)
This commit is contained in:
@@ -95,7 +95,7 @@ export class SkRateLimiterService {
|
||||
if (limit.minInterval < 0) throw new Error(`Invalid rate limit ${limit.key}: minInterval is negative (${limit.minInterval})`);
|
||||
|
||||
const counter = await this.getLimitCounter(limit, actor, 'min');
|
||||
const minInterval = Math.max(Math.ceil(limit.minInterval / factor), 0);
|
||||
const minInterval = Math.max(Math.ceil(limit.minInterval * factor), 0);
|
||||
|
||||
// Update expiration
|
||||
if (counter.c > 0) {
|
||||
@@ -132,7 +132,7 @@ export class SkRateLimiterService {
|
||||
if (limit.dripSize != null && limit.dripSize < 1) throw new Error(`Invalid rate limit ${limit.key}: dripSize is less than 1 (${limit.dripSize})`);
|
||||
|
||||
const counter = await this.getLimitCounter(limit, actor, 'bucket');
|
||||
const bucketSize = Math.max(Math.ceil(limit.size * factor), 1);
|
||||
const bucketSize = Math.max(Math.ceil(limit.size / factor), 1);
|
||||
const dripRate = Math.ceil(limit.dripRate ?? 1000);
|
||||
const dripSize = Math.ceil(limit.dripSize ?? 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user