I'm working with user accoutns for a telephone system and I need to disconnect users once their balance has reached zero.
- User initiates call
- Current balance is retrieved
- Price for phone call is calculated and it is worked out how many whole minutes the user can purchase
- Session hangup time is then stored in the database
I need to poll the database (every second?) to find out if the session hangup time is =< now().
Any advice on polling a database this often, I currently use MySQL but I am willing to change.
cron
won't run often enough. Because I will be getting billed per the minute I need to ensure that the time of this script is accurate.
I was looking at node.js to do the task, never having used node- is it suitable? Would it be worth using a publish/subscribe function of a database? (can't risk any loss of data as this would mean the user could continue on their phone call forever)
Any advice is appreciated.
P.S everything will be server side. There will be no front end to fire requests.