How to run tasks asynchronously on a rolling basis?

Do tasks with uncertain interval
there are functions to resolve them
it is necessary that they all run asynchronously and does not interfere with the basic cycle
March 23rd 20 at 18:47
3 answers
March 23rd 20 at 18:49
I understand this is only colback to do? - maryam_Blan commented on March 23rd 20 at 18:52
@maryam_Blan, result backend Googly - eduardo.Blanda commented on March 23rd 20 at 18:55
March 23rd 20 at 18:51
I think you more multithreading going.
Just run the desired function like this:
from threading import Thread

Thread(target=Washoe, args=ArgumentList).start()

In the end, your function works independently from the others and you can start threads as you need.
I don't think this is a good option because of the challenges comes a lot
and start a thread which does not require a lot of resources is not very razmena in my opinion - maryam_Blan commented on March 23rd 20 at 18:54
@maryam_Blan, so there is no difference in performance. So that the so will run one and the same function. The only difference is that when using async at runtime, the user will start another flood event.listen() to get new events is necessary if you, for example, need to produce a chain of events with a specific user (surveys, for example). Although this can be done with multithreading, just to start a new thread of listening event.listen() and a regular search if a user id is required. Essentially get the same thing, as when you use async.
I don't think your bot has some blocking event.listen operation, except that you run yourself, but for such purposes is multithreading - run independent functions that will not interfere with the main process. - Cloyd.Eichmann commented on March 23rd 20 at 18:57
March 23rd 20 at 18:53
Asyncio. It is very simple unlike treding like and I'll do it myself unlike celery. In order to understand it in 10 minutes suggest aiohttp server to create
It's important to understand that this is cooperative multitasking, which means any blocking operation blocking the entire event loop.

It is often useful to handle blocking operations in a separate thread (if they don't take the GIL) or even in a separate process, for this there is run_on_executor. - mona_Hahn96 commented on March 23rd 20 at 18:56

Find more questions by tags Asynchronous programmingPython