spring-cloud / spring-cloud/spring-cloud-gateway

Allow making replenishRate float?

Open
#2,145 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Java
Stars
4.9k
Forks
3.5k
Avg merge
20h 57m
Merged PRs (30d)
8

Description

Hello!
In some cases it can be useful to make replenishRate float (special cases when 0<replenishRate< 1). So we will be able for example to increase value in the bucket by values < 1 every second (so value 0.1 means to fulfill bucket with 1 token every 10 seconds).

No code changes has be made for lua script to do this, only for config class.

https://github.com/spring-cloud/spring-cloud-gateway/blob/16808fbef751404192edc1d66b52fac6defcd9fb/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/ratelimit/RedisRateLimiter.java#L318

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/ratelimit/RedisRateLimiter.java at the linked configuration code. Check how replenishRate is currently represented and confirm that the existing Lua script needs no changes. Done means the configuration accepts fractional values below 1 and supports the described token replenishment behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, redis, spring
Domain
api, backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.