Running background processes without it stopping the whole site

Hello, I have a process which after a specific websocket command comes through it starts to download files from a outside source to the computer where the backend lives.
But all conclusions I have tried on my own has ended with that the backend stops for all users while it is downloading the files and can only resume when its done.
How would one have this completed while not stopping the backend for all users

Thanks in advanced, Adam

Spawn the download task off to a separate process, such as a Celery task.

Hello, thank you for your quick answer.
Can I from Celery tell the backend when it is done with the download and the next step of the process can proceed

I think you may need to be more specific here as what you mean by “next step of the process”, and what you’re envisioning the complete detailed flow of events will be.

So basically, a leader in a lobby of lets say 4 people clicks start game.
After that, the backend computer downloads youtube videos that the members in the lobbies chose. So the lobby goes into a “loading mode” while it downloads, when its done downloading the process sends back a message to the backend that the lobby can go to the next step.

Keep in mind that whatever is happening in your main thread of execution continues to run after the task is spawned off.

So yes, this can be done, but it’s up to you to manage that signal and the processes that need to happen around it.