Problem with FastAPI's Background Tasks

nothing changed. resp will be returned after 10s again.

But I found a little workaround when I don’t use ray serve but FastAPI and RayCore. Instead of a FastAPI Background task I use a ray task like this

@ray.remote
def long_process(id: str):
    time.sleep(10)
    print(f"{id} has been processed.")

@app.get("/")
async def test_bgtask():
    long_process.remote("1234")
    return {"response before finish processing"}

I found this workaround here.

@eoakes Do you think this workaround has any disadvantages in comparison to ray serve?