MarcoS
MarcoS

Reputation: 17721

how to enforce a minimum delay time among function executions?

I am writing a node function whose executions should be not too close in time (say 5 seconds).

I need to enforce the minimum delay inside the function, and not on the calling side, since its user should know nothing about the delay.
This is the reason why I can't use logic similar to delay or delayed node modules...

Note that I cannot simply setTimeout() wrap the function code either, since I want to enforce a minimum delay among executions (i.e.: the first execution should start immediately).

Upvotes: 0

Views: 247

Answers (1)

clonq
clonq

Reputation: 319

Have you looked at bottleneck? Maybe you want to wrap your function?

Upvotes: 1

Related Questions