Skip to content

Commit c0ccb24

Browse files
committed
chore(docker): default the dev replica apply delay to a realistic 20ms
150ms is useful for deliberately shaking out replica races but is an order of magnitude above typical streaming-replication lag; 20ms keeps the local replica honest by default. Override via REPLICA_APPLY_DELAY.
1 parent 8856bc6 commit c0ccb24

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

docker/docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ services:
5858
# docker exec database bash -c 'grep -q "host replication" "$PGDATA/pg_hba.conf" || echo "host replication all all md5" >> "$PGDATA/pg_hba.conf"'
5959
# docker exec database psql -U postgres -c "SELECT pg_reload_conf()"
6060
# Then point the webapp at it: DATABASE_READ_REPLICA_URL=postgresql://postgres:postgres@localhost:5433/postgres
61-
# Tune the lag via REPLICA_APPLY_DELAY (e.g. 150ms, 2s). Wipe database-replica-data to re-init.
61+
# Tune the lag via REPLICA_APPLY_DELAY (default 20ms ~ realistic prod lag; crank to 150ms/2s to
62+
# shake out replica races). Wipe database-replica-data to re-init.
6263
database-replica:
6364
container_name: ${CONTAINER_PREFIX:-}database-replica
6465
profiles: ["replica"]
@@ -72,7 +73,7 @@ services:
7273
- ${DB_REPLICA_VOLUME:-database-replica-data}:/var/lib/postgresql/data/
7374
environment:
7475
PGPASSWORD: postgres
75-
REPLICA_APPLY_DELAY: ${REPLICA_APPLY_DELAY:-150ms}
76+
REPLICA_APPLY_DELAY: ${REPLICA_APPLY_DELAY:-20ms}
7677
networks:
7778
- app_network
7879
ports:

0 commit comments

Comments
 (0)