Answer the question
In order to leave comments, you need to log in
Periodic events in the application on node.js
I am writing a zero-playing game (something like Godville ), respectively, for each character, whether he is logged in or not, it is necessary to generate a game event every N minutes.
It would be possible to get by with setTimeout, but when the application crashes/restarts, it will be necessary to restore all this, and for all players at once.
It would be possible through cron, but then the calculation of the outcome of the event will occur again for all players at once, and this is somehow stressful for the server, IMHO. Creating a separate cron task for each player is somehow wild.
The third option is that one application generates events and calculates their outcome, while the second only reads from the database and shows the players their adventures, but in this case it is not clear how to send a push notification to the user.
I really don’t like any method, besides, there is a feeling that there are already tried and tested solutions for this kind of tasks.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question