The Billing Bug You Can't Have

Emit bills by the email: you prepay for credits, and every send debits one. Which means somewhere in the system there's a number going down as mail goes out, and a nasty question attached to it: what happens when two sends debit the same balance at the same instant? Get this wrong and you either give away free email (annoying) or charge people for mail that never sent (unforgivable). The fix is…