Commit 77c3059
committed
fix(promo-codes): prevent partial-reservation leak on mid-loop failure
Codex audit of ad113d5 caught a real BUG. Saga::run() at
SummitOrderService.php:131-134 only calls markAsRan() AFTER a task's
run() returns. If reserveMemberQuotas() succeeds for code A and then
throws on code B, the exception propagates before PreProcessReservationTask
is in $already_run_tasks, so saga abort() never invokes this task's
undo() — leaking code A's counter increment on the durable reservation
row.
Guard reserveMemberQuotas() with a local try/catch in run() that calls
$this->undo() (idempotent via the $undone flag) before rethrowing, so
any partial progress is released whether or not the saga reaches us.
Found by Codex review, patch as proposed.1 parent ad113d5 commit 77c3059
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1151 | 1151 | | |
1152 | 1152 | | |
1153 | 1153 | | |
1154 | | - | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1155 | 1165 | | |
1156 | 1166 | | |
1157 | 1167 | | |
| |||
0 commit comments