-
Notifications
You must be signed in to change notification settings - Fork 451
Open
Description
I am using .Net RateLimiting and specifically the TokenBucketRateLimiter. Example:
services.AddRateLimiter(limiterOptions =>
{
limiterOptions.AddPolicy(userPolicyName, context =>
{
string username = Utils.getUsername(context);
return RateLimitPartition.GetTokenBucketLimiter
(username , _ =>
new TokenBucketRateLimiterOptions
{
TokenLimit = myOptions.TokenLimit,
QueueProcessingOrder = QueueProcessingOrder.OldestFirst,
QueueLimit = 0,
ReplenishmentPeriod = TimeSpan.FromDays(myOptions.ReplenishmentPeriod),
TokensPerPeriod = myOptions.ReplenishmentPeriod,
AutoReplenishment = myOptions.AutoReplenishment
});
});
});
This works, but doesn't survive service restarts (tokens get resetted every time the service restarts). From what I could find, it's using internally a memory store for tokens.
How can I change the store used for tokens? I'd prefer to use postgres for persistence if possible, but any kind of persistence will do.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels