Commit 919f4d9
committed
Fix RuntimeError: no running event loop in MQTT reconnection
- Fixed RuntimeError when _on_connection_interrupted_internal tries to create
reconnection task from MQTT callback thread without event loop
- Fixed RuntimeWarning about _reconnect_with_backoff coroutine never being awaited
- Added _start_reconnect_task() helper method to properly create tasks within event loop
- Uses existing _schedule_coroutine() for thread-safe task scheduling
- Prevents crashes during automatic reconnection after connection interruptions
Fixes issue seen in Home Assistant logs:
RuntimeError: no running event loop
RuntimeWarning: coroutine '_reconnect_with_backoff' was never awaited1 parent 265cc0a commit 919f4d9
2 files changed
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
208 | 218 | | |
209 | 219 | | |
210 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
| 276 | + | |
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
302 | 312 | | |
303 | 313 | | |
304 | 314 | | |
| |||
0 commit comments