Our API needs to send data to Zapier if some specific data was modified in our DB.
For example, we have a company table and if the name or the address field was modified, we trigger the Zapier hook.
Sometimes our API receives multiple change requests in a few minutes, but we don't want to trigger the Zapier hook multiple times (since it is quite expensive), so we call a setTimeout()
(and overwrites the existing setTimeout
) on each modify requests , with a 5000ms
delay.
It works fine, and there are no multiple Zapier hook calls even if we get a lot modify requests from client in this 5000ms
period.
Now - since our traffic is growing - we'd like to set up multiple node.js instances behind some load balancer.
But in this case the different Node.js instances can not use - and overwrite - the same setTimeout
instance, which would cause a lot useless Zapier calls.
Could you guys help us, how to solve this problem - while remaining scalable?