Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions ps-cache-kotlin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,19 @@ docker run -d --name pg-demo \
-e POSTGRES_DB=testdb \
-p 5432:5432 postgres:16

# Wait for Postgres to be ready
sleep 3
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a fixed sleep 3 for Postgres readiness is flaky (startup time varies by machine). Consider waiting on pg_isready in a loop (similar to the docker-compose healthcheck in ps-cache-kotlin/docker-compose.yml) so the README steps are deterministic.

Suggested change
sleep 3
until docker exec pg-demo pg_isready -U postgres -d testdb >/dev/null 2>&1; do
sleep 1
done

Copilot uses AI. Check for mistakes.

# Create the schema and seed data
docker exec pg-demo psql -U postgres -d testdb -f- <<'SQL'
CREATE SCHEMA IF NOT EXISTS travelcard;
CREATE TABLE IF NOT EXISTS travelcard.travel_account (
docker exec pg-demo psql -U postgres -d testdb -c "
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

psql defaults to continuing after statement errors and can still exit with status 0, which can make these setup commands look successful even when schema/seed failed. Consider adding -v ON_ERROR_STOP=1 (and optionally -X) to make failures fail fast for users copying the README commands.

Suggested change
docker exec pg-demo psql -U postgres -d testdb -c "
docker exec pg-demo psql -X -v ON_ERROR_STOP=1 -U postgres -d testdb -c "

Copilot uses AI. Check for mistakes.
CREATE SCHEMA IF NOT EXISTS travelcard;
CREATE TABLE IF NOT EXISTS travelcard.travel_account (
id SERIAL PRIMARY KEY, member_id INT NOT NULL UNIQUE,
name TEXT NOT NULL, balance INT NOT NULL DEFAULT 0);
INSERT INTO travelcard.travel_account (member_id, name, balance) VALUES
INSERT INTO travelcard.travel_account (member_id, name, balance) VALUES
(19, 'Alice', 1000), (23, 'Bob', 2500),
(31, 'Charlie', 500), (42, 'Diana', 7500)
ON CONFLICT (member_id) DO NOTHING;
SQL
ON CONFLICT (member_id) DO NOTHING;"

# Build
mvn package -DskipTests -q
Expand Down
Loading