0

I'm wondering if there are any possible risks or memory considerations to using a debounce (in our case, Lodash's implementation: https://github.com/lodash/lodash/blob/ddfd9b11a0126db2302cb70ec9973b66baec0975/lodash.js#L10304) with very large intervals, i.e. 24 hours. Specifically my use case is an event-based call to the backend to send a reminder email, and we don't want to spam customers with more than 1 reminder per day.

This question Building a promise chain recursively in javascript - memory considerations has a similar discussion, but about promises, and many at that (1000s or more). This would be a bit different as it is a single debounced function, and I believe the Lodash implementation of debounce anyway properly handles and manages the setTimeout and timeoutId's properly, so maybe I'm over engineering / overthinking this and we should just ship it and see :)

To sum up, I understand this functionality should be delegated to some sort of backend queue at some point, but is it something we can "get away with" for now in the client?

halfer
  • 19,471
  • 17
  • 87
  • 173
fullStackChris
  • 789
  • 1
  • 8
  • 17
  • I think you are right that it belongs in the backend. Would it be a lot of work for your case? It feels like you just need a database to store email addresses and timestamps, so your queue can ignore requests that come in too quickly. – halfer Apr 25 '22 at 22:46

0 Answers0