Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclosed client session #144

Open
R4ykoo opened this issue Oct 30, 2023 · 1 comment
Open

Unclosed client session #144

R4ykoo opened this issue Oct 30, 2023 · 1 comment

Comments

@R4ykoo
Copy link

R4ykoo commented Oct 30, 2023

Hey, thank you for your work.

I'm working on making an API that waits for requests to turn on bulbs (L530E) with certain colors.
The server receives a request with the color which the bulb must turn into, then the server connects to the TapoClient and LightDevice to make it happen.

This works flawlessly but after every request is done I get the following warning:

Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x00000219B00A2050>

I've tried closing the connection on the tapoClient after setting the color:
await light.set_hue_saturation(data['color'], saturation=100) await light.set_brightness(data['brightness']) await client.close() return Response(status=200, mimetype='application/json')

But doesn't work.

I've tried putting the whole server inside a context manager to close the aiohttp session, just as your code example, but I'm unable to make it right apparently.

Is there any kind of workaround?

Thank you for your time.

@Kiwiwatcher
Copy link

Good morning,
I wondering if there is an update on this issue, and if it is really just a "cosmetic issue", or does it causes impacts such as memory leaks through reallocation to memory resources at each call that are not freed up until the main function exits?

Thank you

ano0002 added a commit to ano0002/plugp100 that referenced this issue Jul 23, 2024
Fixed client not being properly closed when guessing the protocol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants