Im Phil and try to figoure out the best approach for my app. I was searching Stack for my question but I didnt find a completely answer. Assumptions:
- It will be multiple user who can see in real time their vehicles(locations,state, fuel), places(state, is it planted, is it mowed) etc.
- Action taken by players - e.g. User click build/drive and have to wait for example 45min. I want to display to user time to end of action.
- should action be registered in queue system ? ( RabbitMQ or something like this,generally a message queuing system)
- After this time the object of user should change - User get coins or the vehicle change his place from X to Y
- Remove this action from queue and store information about ended action in DB
Is my approach correct? Could I ask for ways to implement this? Or should I go in a completely different direction? I will be grateful for all the advice!
EDIT: I found different solution: Store action in DB to build / drive and save the current timestamp and time when action is finished. Now i should have bacgrond process which will be looking into this DB and change state when the action is finished (add coins to player X e.g.) In the same time when user clik the request to server is send. In response got the time when te action start and finish. Javascript will be drawing to user the progres bar (calculated from current timestamp and from db) What in situation when user not send another request (not rerfresh site)? The script should check if action in finished (current timestamp > timestamp from db ) and then should automatically refresh user site. Is that correct? Second aproach is simpler to implement IMO.