Matthew Kong

Case studies/Yelp, 2017

Restaurant waitlist integration improvements

A pending-first state machine and reconciliation poller, so a provider timeout never becomes a duplicate guest.

Laptop on a desk showing an editor full of code
  1. App
  2. Waitlist API
  3. Durable entry state
  4. Provider adapter
  5. Restaurant provider
  6. Reconciliation poller
  7. Status notification

Why this work, at that time

Yelp acquired Nowait in March 2017 and expanded restaurant waitlist capabilities, which meant more third-party restaurant systems with their own failure modes.

The problem

Restaurant systems could accept a waitlist action and then time out before responding. A blind retry risked duplicate guest entries and confusing arrival estimates.

The team and my part

Five engineers: two backend API, one mobile, one restaurant-integrations engineer, one tech lead, with QA and partner success shared. I owned a single provider adapter end to end.

Data and index design

restaurant_provider(restaurant_id, provider_id, capabilities); waitlist_entry(id, restaurant_id, party_size, status, external_id, version); provider_request(request_id, external_correlation_id, status); event_audit(entry_id, from, to, at).

API and event contract

POST /v1/waitlist-entries with a request_token; GET /v1/waitlist-entries/{id}; POST /v1/waitlist-entries/{id}/cancel. States: PENDING, ACCEPTED, REJECTED, CANCEL_PENDING, CANCELLED.

Core logic

Reserve an internal entry id before calling the provider. On timeout leave the entry PENDING and reconcile with the external correlation id; only transition to ACCEPTED after the provider acknowledges. Ignore duplicate or out-of-order callbacks by version.

Implementation sequence

  1. Capture state diagrams and partner-specific error codes with the integrations team.
  2. Implement the adapter interface with capabilities, timeout policy and standardized error mapping.
  3. Persist the outbound request token and schedule a reconciliation job before the external call.
  4. Build eventual-consistency UI messaging and cancel-safe transitions.
  5. Pilot with about 160 restaurants, alert on status drift, then expand per provider health.

Environments and release

An isolated fake provider with latency and failure injection; staging contract tests and replay fixtures; production flag by provider and restaurant cohort.

Failure drill

The provider accepts the request but returns a 504. Do not POST again. Look up status by correlation id, reconcile or escalate after expiry, and never claim a confirmed seat prematurely.

Scale and targets

Modeled scale

  • About 18K waitlist events per day, 0.21 per second average
  • Busy-hour bursts near 30 per second
  • About 160 restaurant partners in the pilot cohort

Acceptance targets

  • Unresolved status mismatches under 0.2%
  • 99.9% acceptance availability on the Yelp side

Scale figures are the sizing model behind the design. Targets are acceptance criteria, not measured results.

The trade-off I would defend

Prefer an honest “confirming your place” over falsely promising immediate acceptance when the upstream acknowledgement is unknown.