polycratia

The operations team kept the account activity page open all day, and each filter took about three seconds.

The endpoint built each row from scratch. It walked a user's ledger entries, summed them, then asked the verification provider for the current status of everyone in the list. One screen of rows meant that many outbound calls, each waiting on someone else's network.

Most of that was already known at write time. The provider sends a webhook when a status changes, so I started storing the status on the user record when it arrived and reading it from there. Balances moved to a small table updated in the same transaction that writes a ledger entry. The handler became one query and a serializer, a couple hundred milliseconds, mostly Postgres.

The part I still argue with myself about is staleness. A stored status can be wrong for the seconds between the change and the webhook, and a moderator can act in that window.

How do you handle that gap in compliance tooling, a hard refresh when the page opens, or let the stored value stand?

react

$ new-project --brief

or email hey@polycratia.com