scottbonline / sense

Sense Energy Monitor API
MIT License
174 stars 45 forks source link

Only load ssl default ssl certificates once #35

Closed bdraco closed 4 years ago

bdraco commented 4 years ago

Fixes I/O in the event loop

Each update was creating a new ssl context which was doing blocking i/o to load the default ssl certs

homeassistant/components/sense/__init__.py, line 144: await gateway.update_realtime() was calling SSLContext.load_default_certs from when the websocket is created. Normally this goes unnoticed, however since there are frequent connects and disconnects of the websocket it was noticeable.

bdraco commented 4 years ago

Thanks @kbickar