Skip to content

Postgraphile stops retrying when --watch is specified #1276

@Munksgaard

Description

@Munksgaard

I'm submitting a ...

  • bug report
  • feature request
  • question

PostGraphile version: latest on docker

The following docker-compose.yml file reproduces the problem consistently for me:

version: '3'
services:
  postgres:
    image: postgres@sha256:8e096175da9b7a1d5f073e4ff0b2058a68b3110dc9c26bcee0975d25ad1c008e
    expose:
      - 5432
    environment:
      POSTGRES_USER: root
      POSTGRES_DB: testdb
      POSTGRES_PASSWORD: password

  testdb:
    image: nixos/nix@sha256:5d0a26066dc8e9e1295676203cbc15d0e124f445007f9cb888fde25c3d00a1b2
    depends_on:
      - postgraphile
    links:
      - postgres
    entrypoint: >
      /bin/sh -c "
      nix-env -i git openssh postgresql &&
      sleep 2m &&
      PGPASSWORD=password psql --host postgres --user root --dbname testdb -c 'create schema testdb; create type testdb.jwt_token AS (role text, user_id integer);'
      "

  postgraphile:
    image: graphile/postgraphile:latest@sha256:f6ffed7aa2aac7a1499216f3f0880e68456eb4618c831d6bafd68dbdd1b64218
    command: >-
      --connection postgres://root:password@postgres/testdb
      --schema testdb
      --secret secret
      --token testdb.jwt_token
      --retry-on-init-fail
      --watch
    depends_on:
      - postgres

Run by putting that in a docker-compose.yml file and running docker-compose up in the same directory. You'll see the postgraphile try to connect a bunch of times to the schema in the database, but because of the sleep 2m line in testdb it takes a while for the database to be ready. At some point (on my machine it's after 12 retries, but on my server it's after 10 retries) it'll stop retrying.

Removing the --watch argument to postgraphile seems to fix the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions