From cbf3a2ecaee311bb676396b752b0b04ba54152f0 Mon Sep 17 00:00:00 2001 From: Johann Kellerman Date: Fri, 10 Feb 2017 22:22:15 +0200 Subject: [PATCH] [recorder] Run end model changed in session scope (#5858) --- homeassistant/components/recorder/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/recorder/__init__.py b/homeassistant/components/recorder/__init__.py index 8d3213a4805..66eb06f4d27 100644 --- a/homeassistant/components/recorder/__init__.py +++ b/homeassistant/components/recorder/__init__.py @@ -421,8 +421,8 @@ class Recorder(threading.Thread): def _close_run(self): """Save end time for current run.""" - self._run.end = dt_util.utcnow() with session_scope() as session: + self._run.end = dt_util.utcnow() self._commit(session, self._run) self._run = None