Commit 31e2c8e
Fix LISTEN/NOTIFY connection self-healing to prevent worker death (#420)
When EnableLongPolling is enabled, the ListenForNotificationsAsync method
only caught TaskCanceledException, causing all other exceptions (network
timeouts, connection drops) to propagate up and kill the worker thread.
This change adds self-healing reconnection logic that catches connection
failures, reconnects after a 1 second backoff, and continues the loop.
Fixes #410
Co-authored-by: Žygimantas A. <12134941+azygis@users.noreply.github.com>1 parent 82d485e commit 31e2c8e
File tree
2 files changed
+78
-18
lines changed- src/Hangfire.PostgreSql
- tests/Hangfire.PostgreSql.Tests
2 files changed
+78
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 80 | + | |
| 81 | + | |
86 | 82 | | |
87 | 83 | | |
88 | 84 | | |
| |||
282 | 278 | | |
283 | 279 | | |
284 | 280 | | |
285 | | - | |
| 281 | + | |
| 282 | + | |
286 | 283 | | |
287 | 284 | | |
| 285 | + | |
288 | 286 | | |
289 | 287 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | 288 | | |
296 | 289 | | |
297 | | - | |
298 | | - | |
299 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
300 | 311 | | |
301 | 312 | | |
302 | | - | |
| 313 | + | |
303 | 314 | | |
304 | 315 | | |
305 | 316 | | |
306 | 317 | | |
307 | 318 | | |
308 | | - | |
| 319 | + | |
309 | 320 | | |
310 | 321 | | |
311 | 322 | | |
| |||
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
538 | 539 | | |
539 | 540 | | |
540 | 541 | | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
541 | 590 | | |
542 | 591 | | |
543 | 592 | | |
| |||
0 commit comments