Commit edad655
committed
Fix broker stuck in SYNCHRONIZING on DB error during rollback
When a service broker update job fails and attempts to revert the
broker state, a database connection failure could cause the job to
crash without properly handling the original error. This left the
broker stuck in SYNCHRONIZING state with a FAILED job.
This change wraps the state rollback operation in error handling to
catch database errors and allow the original exception to be raised
and the job to be retried properly.
Changes:
- app/jobs/v3/services/update_broker_job.rb: Add error handling around
ServiceBroker.where().update() call in rescue block to gracefully
handle database disconnections during state rollback
- spec/unit/jobs/v3/services/update_broker_job_spec.rb: Add test case
for database disconnect during state rollback1 parent b27da11 commit edad655
2 files changed
Lines changed: 34 additions & 3 deletions
File tree
- app/jobs/v3/services
- spec/unit/jobs/v3/services
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
73 | | - | |
| 78 | + | |
74 | 79 | | |
75 | | - | |
| 80 | + | |
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
449 | 475 | | |
450 | 476 | | |
451 | 477 | | |
| |||
0 commit comments