Monday, 22 May 2017

NodeJS multiple timers and threads

I am creating a nodejs application with postgresql as the db that allows people to make phone calls using the twilio api. Users buy tokens that are equivelent to minutes. 1 token = 1 minute.

When a call is created, I need to check every 30 seconds - 1 minute if there are enough tokens left, and also decrease the user's remaining tokens every minute.

As there are multiple users and multiple timers running at the same time, I need a way to do this efficiently



via Phil

No comments:

Post a Comment