craibo / ha_strava

Strava Activities and Summary data integration for Home Assistant
MIT License
78 stars 9 forks source link

Not handling Co-routine correctly #157

Closed craibo closed 5 months ago

craibo commented 6 months ago

Not handling failed coroutine correctly

Logger: py.warnings
Source: runner.py:190
First occurred: 05:56:39 (1 occurrences)
Last logged: 05:56:39

/usr/local/lib/python3.12/asyncio/base_events.py:1989: RuntimeWarning: coroutine 'async_setup_entry.<locals>.async_strava_config_update_handler' was never awaited handle = None # Needed to break cycles when an exception occurs.
Logger: homeassistant
Source: helpers/frame.py:203
First occurred: 05:56:39 (1 occurrences)
Last logged: 05:56:39

Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ha_strava/__init__.py", line 824, in strava_config_update_handler
    hass.async_create_task(async_strava_config_update_handler())
  File "/usr/src/homeassistant/homeassistant/core.py", line 816, in async_create_task
    self.verify_event_loop_thread("async_create_task")
  File "/usr/src/homeassistant/homeassistant/core.py", line 440, in verify_event_loop_thread
    frame.report(
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 162, in report
    _report_integration(what, integration_frame, level, error_if_integration)
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 203, in _report_integration
    raise RuntimeError(
RuntimeError: Detected that custom integration 'ha_strava' calls async_create_task from a thread at custom_components/ha_strava/__init__.py, line 824: hass.async_create_task(async_strava_config_update_handler()). Please report it to the author of the 'ha_strava' custom integration.