snarky-snark / home-assistant-variables

A custom Home Assistant component for declaring and setting generic variable entities dynamically.
Apache License 2.0
274 stars 16 forks source link

Error doing job: Task exception was never retrieved #89

Closed maforshaw closed 4 months ago

maforshaw commented 1 year ago

Every time a tracked entity is changed, I get the following errors in the log and the var fails to update. It appears this was supposed to be fixed by #70 but there are 2 calls to be database and I think one may have been missed? In my case, since I use SQL, it calls the function "_is_event_in_db" which doesn't seem to have been changed to use the non-blocking approach in the _get_variable_event_listener function.

HA 2022.10.4

Detected blocking call to _do_get_db_connection_protected inside the event loop. This is causing stability issues. Please report issue for recorder doing blocking calls at homeassistant/components/recorder/pool.py, line 75: check_loop

Error doing job: Task exception was never retrieved
RuntimeError: Blocking calls must be done in the executor or a separate thread; Use homeassistant.components.recorder.get_instance(hass).async_add_executor_job(); at homeassistant/components/recorder/pool.py, line 75: check_loop

Traceback (most recent call last):
  File "/config/custom_components/var/__init__.py", line 286, in update_var
    while not self._is_event_in_db(event):
  File "/config/custom_components/var/__init__.py", line 265, in _is_event_in_db
    event_data=json.dumps(event.data, cls=JSONEncoder)).scalar()
snarky-snark commented 9 months ago

This looks fixable, but I don't think I will be able to get to it any time soon, unfortunately.

snarky-snark commented 5 months ago

Related to #96.