The warehouse is in the basement. Three-floor office, one floor down. Inventory on open metal shelves – row by column, every product a known address. I’ve been to bigger warehouses. The kind where one end isn’t visible from the other and you can’t tell what’s going on at a glance. This one isn’t like that. You can stand at the door and see the whole operation.

An order comes in upstairs. The printout arrives at the front desk, gets handed over as a pick list – reordered so a person can fetch the items in a single sequential pass through the aisles. The basket goes through quality check, then into the black box – three layers, bubble wrap, thermocol where it matters. A label with tracking comes off a printer and gets pasted on. The box moves to the dispatch desk. The courier comes by later in the day. Two or three days to the customer. Same-day if they’re close.

The dispatch desk is one person and a barcode scanner. Pick up a box, scan the label, wait for the console to say green. Pick up the next box.

The wait is three to five seconds. The scan fires an API call, and the API does everything before returning. State transition in the order management system. Tracking record creation. Customer notification. Inventory sync. The console confirms. The person moves on.

Three to five seconds doesn’t sound like much. Over an hour, it is.

The change

None of that work needs to happen in the request. The scan needs two things to be true before the console turns green: the order exists and is ready to dispatch, and we won’t forget to do the rest. Everything else can run out of band.

I rewrote the handler. Validate the scan, insert a row into a MySQL table – accepted_dispatches, one row per scan, with enough context to replay the work. Return 202 Accepted. A background worker polls the table and drains it: state transition, tracking record, notification, inventory sync. When it finishes a row, it marks it done.

The dispatch desk sees green in under a second. Then it sees green again. Then again.

The cost is real. A box scanned at 3pm might get its notification at 3:02 instead of 3:00. If the worker falls behind, the gap grows. Nothing is lost – the rows are there – but the work queues up.

For the dispatch desk, the trade is obvious. Nobody at the dispatch desk is waiting for the customer notification.

The basement hasn’t changed. The dispatch desk has.