Answer the question
In order to leave comments, you need to log in
How to make a dynamic backend?
There is a room that is stored in the database and gradually filled in by users of the site. When the room is full, the time is set to the time variable and at that time the room should clear.
How can I do that? Should I use timeouts or if any other methods?
{
time: 1597320396718
users: [25, 21, 12]
}
Answer the question
In order to leave comments, you need to log in
Yes, it is most convenient to set a timeout, and so that after the scheduled time the function will be called and clean the room.
If millisecond precision is not required, then server resources can be saved. Create a queue, and every minute (or 10 seconds) check the first one in the queue for timeout. And then clean it up.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question