Wrap possible I/O in executor (#37688)

This commit is contained in:
jjlawren
2020-07-12 17:09:47 -05:00
committed by GitHub
parent 6fe54e31cc
commit 5c28919fba

View File

@@ -116,8 +116,9 @@ class PlexSensor(Entity):
# "picture_of_last_summer_camp (2015)"
# "The Incredible Hulk (2008)"
now_playing_title = sess.title
if sess.year is not None:
now_playing_title += f" ({sess.year})"
year = await self.hass.async_add_executor_job(getattr, sess, "year")
if year is not None:
now_playing_title += f" ({year})"
now_playing.append((now_playing_user, now_playing_title))
self._state = len(self.sessions)