You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: Background tasks must be configurable by each receiver, as we still need to have receivers that are required to be finished before continuing. This might for example be true for a receiver that sets the modification date of something before it is stored to the database. Also we should add an option to send() so disable background tasks.
The text was updated successfully, but these errors were encountered:
We can just use asyncio.create_task(...) to schedule the task
The signal instance needs to keep track of all running tasks in a set, so the tasks won't get garbage collected
We can use a add_done_callback to clean the task from the set when finished
We however need to add docs so people won't add CPU heavy tasks as background jobs, this really is just for receivers that are ok to be handles some microseconds later. If something really needs the CPU (or worse calls some sync IO functions) this has to be done in celery/arq.
Allow receivers to run in the background by just adding the task to the event loop queue, but not
await
ing it. Could do something similar to https://fastapi.tiangolo.com/tutorial/background-tasks/.Note: Background tasks must be configurable by each receiver, as we still need to have receivers that are required to be finished before continuing. This might for example be true for a receiver that sets the modification date of something before it is stored to the database. Also we should add an option to
send()
so disable background tasks.The text was updated successfully, but these errors were encountered: