Skip to content

v3.0.0

Choose a tag to compare

@SAY-5 SAY-5 released this 05 Sep 22:24
· 12 commits to main since this release

Surge pricing per geohash cell.

  • Trips record pickup_cell (precision-5 geohash) and the surge_multiplier they were priced at (Alembic 0003, indexed on (pickup_cell, requested_at)).
  • Demand per cell is a half-life-decayed sum of recent requests (60 s half-life by default); supply is the count of available, unexpired drivers in the cell. The multiplier is 1.0 while supply covers demand and otherwise 1 + 0.5 * (demand/supply - 1), capped at 3.0. Nothing is counted incrementally, both numbers are read from PostgreSQL and DynamoDB at request time, so replicas cannot drift.
  • POST /rides prices the trip against the demand already queued in its cell; GET /rides/surge?lat&lng quotes a point; GET /dispatch/heatmap lists every cell with recent demand or available supply, hottest first.
  • Configuration: SURGE_HALF_LIFE_S, SURGE_STEP, SURGE_MAX_MULTIPLIER.
  • Tests: multiplier curve, decay arithmetic, a burst of requests in one cell driving the multiplier up through the HTTP service and cooling off ten minutes later, heatmap ordering through the dispatch service, migration 0003 up and down. 79 tests total.