You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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.
The text was updated successfully, but these errors were encountered: