Skip to content

Commit

Permalink
Few changes related to memory leak #72
Browse files Browse the repository at this point in the history
  • Loading branch information
erikkastelec committed May 10, 2023
1 parent 6540941 commit 923acfe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions custom_components/wemportal/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ async def _async_update_data(self):
self.config_entry.data.get(CONF_PASSWORD),
self.config_entry.options,
)
del self.api
self.api = new_api
except Exception as exc2:
raise UpdateFailed from exc2
Expand Down
2 changes: 2 additions & 0 deletions custom_components/wemportal/wemportalapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ def api_login(self):
"AppVersion": "2.0.2",
"ClientOS": "Android",
}
if self.session is not None:
self.session.close()
self.session = reqs.Session()
self.session.cookies.clear()
self.session.headers.update(self.headers)
Expand Down

0 comments on commit 923acfe

Please sign in to comment.