M
M
MichaelMih2021-04-07 22:23:27
API
MichaelMih, 2021-04-07 22:23:27

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

1 answer(s)
R
rPman, 2021-04-08
@MichaelMih

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 question

Ask a Question

731 491 924 answers to any question