Docs › Releases › 1.07 › Release notes
Recurnix 1.07 release notes
Released 2026-07-30. Recurnix 2.11 is newer.
A coupon capped at 100 redemptions could be redeemed 130 times.
The cart counted the redemptions and said yes. Checkout, some seconds later and inside its own transaction, wrote a new one. Nothing held those two moments together, so two customers arriving in the same second were both counted against the same remaining slot, and both got the discount.
That is not a theoretical race. On the sandbox, with a coupon capped at a single redemption and two real PHP processes, the second one reserved in 8 milliseconds while the first was still holding its reservation. Under load - which is precisely when a promotion is running - the overshoot grows with the number of people checking out at once. Nothing in the admin would have flagged it; you would have found out from the uses column reading 130 against a cap of 100, after the money was gone.
The fix is a lock, in the one place a redemption is ever written. The reservation now takes the coupon row exclusively and re-counts while holding it. The row is the rendezvous - every writer has to pass through it - so the second cart waits for the first to finish and then sees what it did. Measured the same way as before: the second process waited out the full lock timeout and never got in.
Reading it properly also turned up why it went wrong in the first place. The rule "is this coupon used up?" was written out three separate times, and the copies did not agree: the one on the Coupon model compared the uses counter alone, so it did not count a cart that was mid-checkout, while the service's copy did. That model method had no callers anywhere - it was simply sitting there being wrong, waiting for someone to reach for it. It is gone, and there is now exactly one implementation of the rule, which both the cart and checkout call.
The cart that loses the race gets the ordinary "that coupon has reached its usage limit" message and its cart back, unchanged. Because the refusal is thrown from inside the transaction that creates the order, the services and the invoice, all of that unwinds together: a losing checkout leaves nothing behind at all - not a half-made order, not an orphaned invoice.
Two smaller things came out of the same reading. A coupon deleted while someone had it in their cart used to end in a foreign-key violation, which reaches the customer as a 500 page; it is now refused by name like an expired one. And the admin's Total redemptions field would happily accept 0, quietly producing a coupon that could never be used; it now has a floor of 1 and says out loud that carts still in checkout count against the total.
The project also has real tests again - eleven of them now, up from two, and none of them needs a database.
Upgrading needs nothing. Existing coupons, reservations and captured uses are untouched, and no stored data changes shape.