question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

it is just does not work for this simple koa app: `const Koa = require(‘koa’); const ratelimit = require(‘koa-ratelimit’); const Promise = require(‘bluebird’); const redis = require(‘redis’);

const redisOption = {}; const redisClient = redis.createClient(redisOption); Promise.promisifyAll(redis.RedisClient.prototype); Promise.promisifyAll(redis.Multi.prototype); redisClient.once(‘ready’, () => { console.log(‘redis connnection ready’); }); redisClient.on(‘error’, (err) => { console.log(‘can't connect to redis’, err); process.exit(1); });

const app = new Koa();

// apply rate limit

app.use(ratelimit({ db: redisClient, duration: 10000, max: 10 }));

// response middleware

app.use(async (ctx) => { ctx.body = ‘Stuff!’; });

app.listen(4000); console.log(‘listening on port 4000’); ` then keep trying send request use postman, right after the duration pass the remaining time will jump to a random num, even with a negative value, e.g.

Rate limit exceeded, retry in -412 ms.

I am using NodeJs v8.11.1, Redis 3.0.0, “koa”: “^2.5.1”, “koa-ratelimit”: “^4.1.2”, “redis”: “^2.8.0”,

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
koalexcommented, Nov 3, 2020

This issue is mented in Update 09/2020 but it still not working with node-redis. And also it’s not problem with koa-ratelimit 😃 https://github.com/microlinkhq/async-ratelimiter/issues/22

1reaction
animircommented, Nov 7, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there any difference between "it's not working" and "it doesn ...
"It doesn't work" means that something is permanently broken, or is never effective. Here are some example situations: Your television is broken. A...
Read more >
Which is correct, 'it doesn't work' or 'It doesn't works'? - Quora
“it doesn't work” is correct. As you know, English uses the helping verb do for negative statements and for questions. The only thing...
Read more >
It does not works or It does not work? - TextRanch
It does not work vs It does not works. A complete search of the internet has found these results: It does not work...
Read more >
what is the difference between "it did not work" and ''it does not ...
I want to express the meaning that the CD player still does not work now, but the past tense cannot express the present...
Read more >
"Why does it not work" Vs. "Why is it not working"?
Native speakers say both: Why isn't it working? Why doesn't it work? Both questions mean "What's wrong with it?" or "What is causing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found