From 376b787e4dfb14d8418b29ffe172a255b60a3d93 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 25 Apr 2021 00:05:49 -1000 Subject: [PATCH] Skip recorder commit if there is nothing to do (#49614) --- homeassistant/components/recorder/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/homeassistant/components/recorder/__init__.py b/homeassistant/components/recorder/__init__.py index db20c72c81e..9e9592f8687 100644 --- a/homeassistant/components/recorder/__init__.py +++ b/homeassistant/components/recorder/__init__.py @@ -666,6 +666,9 @@ class Recorder(threading.Thread): return False def _commit_event_session_or_retry(self): + """Commit the event session if there is work to do.""" + if not self.event_session.new and not self.event_session.dirty: + return tries = 1 while tries <= self.db_max_retries: try: