sourcefuse / loopback4-ratelimiter

A Rate Limiting Extension for Loopback 4 Applications
https://www.npmjs.com/package/loopback4-ratelimiter
MIT License
37 stars 10 forks source link

Mongodb connections peak and reach 500 #139

Closed AymenLoukil closed 9 months ago

AymenLoukil commented 1 year ago

Describe the bug When using this extension with MongoDB Atlas, the number of connections peak and reaches 500. To Reproduce Steps to reproduce the behavior: 1-Here is the configuration used on Loopback:

this.bind(RateLimitSecurityBindings.CONFIG).to({ name: 'MongoDbDataSource', type: 'MongoStore', uri: db_url, collectionName: 'expressRateRecords', windowMs: 60 * 60 * 1000, max: 42, standardHeaders: true, // Return rate limit info in theRateLimit-headers legacyHeaders: false, // Disable theX-RateLimit-headers });

  1. @ratelimit(true) on the controller endpoint
  2. The number of connections increased until reaching 500 on Atlas.
  3. When I turned ratelimiter off on this endpoint @ratelimit(false) the problem is solved and the number of connections is kept at 7! Expected behavior MongoDB connections shouldn't peak. Screenshots

image

What should I do to fix this? Thanks

stale[bot] commented 10 months ago

This issue has been marked stale because it has not seen any activity within three months. If you believe this to be an error, please contact one of the code owners. This issue will be closed within 15 days of being stale.

stale[bot] commented 9 months ago

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners.