I
I
ikerya2017-05-08 20:40:18
MySQL
ikerya, 2017-05-08 20:40:18

How to make blocking work for a large number of requests?

Hello. The matter is that I use sockets. And almost at the same time, for example, at 20 hours and 0 minutes, for all users, the script sends a request to the socket server. By sending this request, I have a goal: to execute the event I need (1.1) once, and return the results to everyone. But I don't quite succeed.
I do this: when a request comes from a user, I check if there was a request before, and if not, I mark in the database that the request has just happened. Further, if someone else sends a request, it is already clear that the request has already occurred, and the current client is waiting for the execution of the event I need (1.1). The problem is that sometimes Node.JS does not have time to execute a request to the database, and during this time, while the request is in progress, it manages to "skip" several clients and I need events (1.1) to be executed as many times as the number of users skipped, plus that user that initiated the first request.
How to be? Is there some sort of algorithm? Already broke his head.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2017-05-08
@vshvydky

And weakly broadcast from the server to throw everything?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question