Skip to content
Discussion options

You must be logged in to vote

Is this the correct way to tackle long cpu-lock tasks?

No, it is not. I recommend reading this article from our docs: https://docs.litestar.dev/latest/topics/sync-vs-async

The background tasks still run in the same process as your application, so for CPU bound tasks, you're not gaining anything.

For long running / compute heavy tasks, you want to offload the process to a task queue, like celery.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Risiamu
Comment options

@Risiamu
Comment options

@provinzkraut
Comment options

@Risiamu
Comment options

Answer selected by Risiamu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants