xavi- / node-simple-rate-limiter

A simple way to rate limit how often a function is executed.
76 stars 10 forks source link

wish: option to limit queue size (security feature) #5

Closed markstos closed 1 year ago

markstos commented 8 years ago

A potential problem arises with the current design when an outside user is responsible for generating items that go into the queue.

If the user can cause items to queue faster than they are processed, memory will eventually be exhausted, leading to unpredicatable and possible undesirable results.

For a given application, there is a likely a finite number that would be a reasonable queue size limit-- something much higher than normal use, but less than all the memory in the system.

If this limit were ever reached an exception could be thrown.

xavi- commented 1 year ago

Good suggestion. Added. Thanks!