Answer the question
In order to leave comments, you need to log in
How to make multi-threaded execution of commands?
Good day. How to make the execution of bot commands in such a way that they are executed without delay? Let's say 20,000 users enter a command, and the response for them was instant.
Answer the question
In order to leave comments, you need to log in
Absolutely all actions that require time to complete must be asynchronous, run in separate threads. At a minimum, this is working with a database, network requests, and even files.
Easier - you need the handler itself to work not in one thread, but in several or even processes / servers, i.e. run several handlers, and the central one, through which the connection goes, should only redirect requests.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question