Mint an opaque UUID token, in one insert

FeatureMediaService
Shipped
August 20, 2026 at 2:43 PM UTC
Author
Kamo
Commit
3bd5e82

createCode generates the token itself, so there is nothing to read first and nothing for two tabs to collide over. That removes the whole apparatus the old sequential token needed: the max(iteration) + 1 read, the collision-detecting retry, and the REQUIRES_NEW TransactionTemplate that retry needed because a unique_violation aborts the transaction it happened in on YSQL. One save, done. A UUID collision is not a case worth writing code for; the unique index on CODE stays as the backstop so an impossible one fails loudly rather than quietly attributing two members' traffic to one row.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing