Comments (4)
Hello,
Can you give me a gist with a full example on how you initialize the store, what period do you use, what code do you execute after do stuff
because you've logged something in débug and I don't see it in your snippet. And also, what topology of redis do you use (simple, sentinel, cluster?)
Thank you.
from limiter.
Here's what I could come up with @novln. I was able to reproduce with rates of 1-S and 1-M. I've also attached the code + go.mod/go.sum files.
https://gist.github.com/Xopherus/7423f7b2b60264b94bb9dd5c9ebe9c7d
from limiter.
Ok I'm able to reproduce that, thank you for the gist.
I think the issue is how we compute the Reset
value and how expiration works on redis.
For a small fixes (for the time being) add one second to the Reset value. I'll try to find some time to investigate that issue further.
Cheers,
from limiter.
Because the expiration is somewhat imprecise between the PTTL
redis command, the conversion from this duration to a concrete time.Time
and then, the conversion to unix
timestamp, we loose some milliseconds of precision.
I won't fix this issue (for the moment) because it means a refactoring that I don't want to manage.
My recommendation: If the sleep duration is below zero, change it to 500 ms to force a next tick.
With that being said, I'll gladly review pull request.
Cheers,
from limiter.
Related Issues (20)
- Feature Request: Please can you add rqlite as store HOT 2
- Limit for every 5 minute HOT 1
- Please consider adding SkipList option HOT 1
- Rate limiting based on custom identity HOT 2
- ERR bad lua script for redis cluster HOT 1
- Which time windows does this limiter use? HOT 1
- Custom keys? HOT 1
- limit of dynamic route HOT 1
- Should use the rightmost ip in x-forwarded-for, if used at all HOT 7
- another dynamic limit need HOT 9
- Limiters with momery store are not working as expected HOT 3
- A key can be limited forever HOT 2
- About algorithms HOT 2
- Consider changing the in memory cache library HOT 1
- I plan to consider using limiter middleware in the management system
- Gin Middleware Limiter with momery store are not working
- Consider support long time connection rate limit (Websocket) HOT 1
- Add custom Header value for limiter Option
- Feature Request: Please support goframe framework HOT 1
- Add ruedis support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from limiter.