BackgroundTask context not returning Memory when using aiohttp client #2790
-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
Can you send the |
Beta Was this translation helpful? Give feedback.
-
?Just curious could you try to see if this still happens with https://github.com/adriangb/asgi-background? |
Beta Was this translation helpful? Give feedback.
-
Hello @rumbarum, @Kludex i have done some researches and now i can give you more details about this situation. Short Answer: there is not problem with Long Answer with explanation:
So where is the difference? To give you a more concrete example:
If you are testing point N1: If you are testing point N2: You can make a small change to your locust file to reproduce the same scenario in point 1 using point 2. Supposing aiohttp_run takes 1s class HelloWorldUser(HttpUser):
@task
def hello_world(self):
self.client.get("/")
time.sleep(1.2) Said that BackgroundTask should not be used on high rate endpoints as a base rule ( this is my opinion ). |
Beta Was this translation helpful? Give feedback.
Hello @rumbarum, @Kludex i have done some researches and now i can give you more details about this situation.
Short Answer: there is not problem with
BackgroundTask
,aiohttp
or anything related with that.Long Answer with explanation:
aiohttp_run
inside the endpoint you are basically waiting for the response before responding to the client.aiohttp_run
to a BackgroundTask, you are basically "schedulig" a task after the response and returning the response.So where is the difference?
Referring to point 1 you are using ju…