Giter Site home page Giter Site logo

Comments (2)

jmcdo29 avatar jmcdo29 commented on May 17, 2024 1

Without using the RedisStorage, the module throws an exception after 30 requests, as you've set.

I used this zsh script to test it

throttlerTest() {
  dummy=count
  count=0
  while true
  do
    curl -s --fail http://localhost:3000/app/hello
    if [ $? -ne 0 ]
    then
      echo "We got rate limited"
      curl -v http://localhost:3000/app/hello
      break
    fi
    (($dummy += 1))
  done
  echo "Requests made before limiting:"
  echo $count
}

And got back

❯ throttlerTest
Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!We got rate limited
*   Trying ::1:3000...
* TCP_NODELAY set
* Connected to localhost (::1) port 3000 (#0)
> GET /app/hello HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 429 Too Many Requests
< X-Powered-By: Express
< Retry-After: 60
< Content-Type: application/json; charset=utf-8
< Content-Length: 68
< ETag: W/"44-McWaoNlzt3iglN2odEGCDEADErE"
< Date: Wed, 24 Mar 2021 04:05:14 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
<
* Connection #0 to host localhost left intact
{"statusCode":429,"message":"ThrottlerException: Too Many Requests"}Requests made before limiting:
30

So like you said, it works normally, meaning there's a problem with how the sub-library works and returns the ttls that are used in this line for the header calculation

from throttler.

kkoomen avatar kkoomen commented on May 17, 2024

Fixed in kkoomen/nestjs-throttler-storage-redis v0.1.12.

from throttler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.