D
D
dfhkjhg2020-08-13 15:17:56
JavaScript
dfhkjhg, 2020-08-13 15:17:56

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

1 answer(s)
T
t800zippygod, 2020-08-13
@t800zippygod

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 question

Ask a Question

731 491 924 answers to any question