Skip to content

Commit

Permalink
[SQL Sensor] always close session (#12452)
Browse files Browse the repository at this point in the history
* close aborted session

* blank line
  • Loading branch information
dgomes authored and balloob committed Feb 16, 2018
1 parent c7c0df5 commit d43a8e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/sensor/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def update(self):
except sqlalchemy.exc.SQLAlchemyError as err:
_LOGGER.error("Error executing query %s: %s", self._query, err)
return
finally:
sess.close()

for res in result:
_LOGGER.debug(res.items())
Expand All @@ -141,5 +143,3 @@ def update(self):
data, None)
else:
self._state = data

sess.close()

0 comments on commit d43a8e5

Please sign in to comment.