fix rate limit scaling (it's no longer inverted)
This commit is contained in:
parent
91c9b67cb0
commit
fc4599ec07
2 changed files with 7 additions and 7 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue