Delivered for a a live-games module on the multi-tenant wagering platform we build and operate, through Platform to Platform.
The challenge. A live-games module topped up its shelf of live bets on a timer, and every quiet period converted that fresh stock into promo liability the moment each race jumped.
Context
One of the modules on the multi-tenant wagering platform we build and operate is a live-games module. It works like a shelf in a shop: the module places live bets into an inventory ahead of demand, and players take them off the shelf as they play. The standing invariant, written into the module from the start, is simple: never let the live shelf run empty. A player who opens the module and finds nothing to take does not come back.
The stock has an expiry mechanic that shapes everything else. A live bet on the shelf is ordinary stock only until its race jumps. At the jump, any bet still unsold converts to promo stock — inventory that can no longer be sold and can only be given away. Promo stock still has value, but it is a cost all the same, and how much of it exists is a direct function of how well placement matched demand.
The problem
Placement originally ran on a timer. On each cycle the module checked whether the shelf looked thin and, if so, bought a fresh batch. While players are actively consuming, that behaviour is fine — the shelf thins because bets are being taken, the timer restocks, and the restock is sold before the races jump.
The failure is that a level check cannot tell you why the level is low. A shelf is thin either because players consumed the stock or because the races on it jumped with nobody playing. The timer treated both identically. So in every quiet period (overnight, and any stretch of a low-traffic day) the cycle became a machine for converting fresh stock into promo liability: buy a batch, nobody takes it, the races jump, the unsold bets convert, the shelf is thin again, buy a batch. Each pass through that loop manufactured cost, and the invariant made the loop look like correct behaviour, because the shelf was indeed never empty.
Nobody had decided this. The timer encoded an assumption (thin means consumed) that held during live play and failed silently outside it.
What we built
We replaced the timer with event-driven placement. The trigger for buying stock is now a consumption event: a player taking a bet off the shelf. Demand is the signal, so replenishment scales with actual play. When the module is idle there are no consumption events, no buying, and no fresh stock queued up to expire into promo liability.
The invariant survived, but its role changed. Never-empty is now a floor rather than a target: a minimum-stock backstop tops the shelf up only when it genuinely approaches empty, holding just enough inventory that the first player back always finds something to take. The timer had been buying back to a comfortable level on every cycle regardless of demand; the floor buys the minimum required to keep the promise, and consumption events do the rest.
The distinction that made the fix work is worth stating plainly: the shelf level tells you where you are, and only the event stream tells you why. Once placement listened to events instead of reading the level, the two kinds of thinness (consumed versus expired) stopped being confusable, because only one of them produces events.
Results
No performance figures for this module are cleared for publication, so there are none here. The outcomes we can state:
Quiet periods stopped generating promo stock. With no consumption events, the module holds the floor quantity and nothing more, so an overnight stretch no longer runs the buy-expire-buy loop.
Promo liability now scales with play. Unsold expiry still happens when a player walks away mid-session and leaves stock to jump, but it is proportional to how close placement runs to live demand. Elapsed timer cycles no longer enter into it.
The shelf still never runs empty. The floor preserves the original promise. The fix removed the over-buying, not the guarantee.
What we would do differently
The timer encoded an assumption about demand that nobody had written down. The written rule was “never let the live shelf run empty”, and that rule was honoured throughout. The unwritten one, “a thin shelf means players are consuming”, did the damage, precisely because it was never stated anywhere it could be challenged.
The general lesson we took: a scheduled job is a model of the world. It asserts that the world at each tick looks the way it looked when the schedule was chosen. When the world disagrees (a quiet period, a market closure, a tenant in a different timezone), the job does not notice; it keeps executing the model. Anywhere a scheduled job’s cost depends on demand, we now either drive it from demand events directly or write the demand assumption into the job’s documentation as a claim that can be reviewed and falsified, rather than leaving it implicit in the interval.