Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why is the isClosed true after successfully connected #72

Open
vfiruz97 opened this issue Dec 18, 2023 · 1 comment
Open

why is the isClosed true after successfully connected #72

vfiruz97 opened this issue Dec 18, 2023 · 1 comment

Comments

@vfiruz97
Copy link

vfiruz97 commented Dec 18, 2023

I have a problem in the production for reason. There is an issue almost like this issue#57 one. When occur any issue like passing wrong column name or smthg like that and after that sometimes we get closed connection and next queries fall with error Due to closed connection. As I declare my db variable final so I can fix my issue by reloading server. Now I want to check connection state before get Database instance and decide to whether reinitiate connection or not.

void main() async {
  final db = Database(
        '''
  );

  await db.open();
  print('isClosed: ${db.connection().isClosed}');
}

Just for Notice
My postgres is running in a different Docker container and my server is running in a different one. When any error occurs on the postgres site, its docker restarts and my server loses connection. How I can check state and reinitiate connection? I am open for any solution

postgress_db:
    container_name: "rohtj_db"
    image: postgres:16
    restart: always
    volumes:
      - ./rohtj_db/data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: rohtjdb
      POSTGRES_USER: rohtjdbuser
      POSTGRES_PASSWORD: ------
      PGDATA: /var/lib/postgresql/data/pgdata
    ports:
      - 5434:5432
    expose:
      - 5434
    networks:
      - rohtj-backend
@schultek
Copy link
Owner

schultek commented Feb 5, 2024

Please check if this issue still happens with version `0.14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants