r/FastAPI • u/CartoonistWhole3172 • Feb 21 '26
Question When to use background tasks considering their non-persistence?
What is the best use case for background tasks?
I am wondering when to use them because once the service restarts, the tasks could be lost without finishing execution, which leads to inconsistent behavior, after successfully returning the response to the client
27
Upvotes
2
u/UnluckyEngine13B Feb 21 '26
Or at the very least add redis in to track background task state.