Response.background should be BackgroundTasks instead of BackgroundTask | None #2745
Unanswered
Stefano-Nicoli
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I found myself in the situation where I receive a Response.background object (I don't know in advance what it is excatly) and I simply need to add a task to it.
The current implementation (BackgroundTask | None) makes me do something like:
while I would like to have something like:
In order to achieve so, I would implement some simple changes like:
and
I checked locally and with a few changes the code would adapt nicely to this.
I'm not an expert in async web services, so I might be missing some details, but I hope this can help :)
edit: added a small commit in a fork: master...Stefano-Nicoli:starlette:sn/response_background
Beta Was this translation helpful? Give feedback.
All reactions