joshbeckman / mongo-throttle

Basic IP rate-limiting middleware for Express stored in mongoDB. Use to throttle or limit incoming request rate.
https://www.npmjs.com/package/mongo-throttle
MIT License
8 stars 6 forks source link

Bug: stack not connecting to mongodb #8

Closed thatfatbastard closed 7 years ago

thatfatbastard commented 8 years ago

I'm using mongo-throttle in a MEAN stack, and it seem to cause an infinite timeout when it's not commented out. I'm on version 1.0.5.

GreenPioneer commented 8 years ago

@andjosh I have seen @thatfatbastard issue and it looks like for some reason his model says the throttle is there but when he trys to run to save the IP it just gets stuck in limbo. If our Mongoose ready state was working this would have been the perfect opp.

joshbeckman commented 8 years ago

@thatfatbastard can you provide details about the setup flow for connections between app, mongo-throttle, and mongoose?

GreenPioneer commented 8 years ago

@andjosh Did some more looking and what it appear to be is the when we use a localhost connection for mongo everything goes smooth. No matter the order in which mongo-throttle is called. But When i use a Tri Located mongo replication across different regions i run into this issue of our packaged just hanging at the call. If i only use one mongo in a different region it will do that same thing and basically never allow the throttle to be in a ready state. so the throttle just hangs.

Either way i can redo the order of the mean stack but im more interested in how can we solve the package getting hung with having to force a still or hack on users

TESTED WITH - Devices, OS &Versions didn't make a difference Mac Book Pro , Lenovo Thinkpad t450 (windows 7) Node 6.9.1 & 4.8.x i forget the number Using Mean Stack Js 1.1.0

joshbeckman commented 8 years ago

Well, that's tough. If we can't use Mongoose readyState reliably, I'm not sure how we can even be sure of a connection.