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

Update PostgreSQL connection pool handling #2525

Conversation

mpastecki
Copy link
Contributor

Description

This improves the handling of database pool connections that are explicitly used in the code to verify SSL settings and to set up the database schema-change listener. Previously, these two clients were either idle or waiting for the rare event of a schema change.

In environments where idle TCP connections are eventually killed, these connections were terminated, causing the entire app to crash due to an uncaught exception.

Additionally, an error handler has been attached to the schema change PostgreSQL client to listen for error events. This should improve visibility into any issues that arise. When an error occurs, it will be logged, and the application will be terminated to prevent potential data corruption.

Fixes (#2520 )

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • I have tested locally
  • I have performed a self review of my changes
  • Updated any relevant documentation
  • Linked to any relevant issues
  • I have added tests relevant to my changes
  • Any dependent changes have been merged and published in downstream modules
  • My code is up to date with the base branch
  • I have updated relevant changelogs. We suggest using chan

Changelog updated

keep-alive-interval config item name change
Copy link
Collaborator

@stwiname stwiname left a comment

Choose a reason for hiding this comment

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

This looks good, just a couple of minor improvements

packages/query/src/graphql/graphql.module.ts Outdated Show resolved Hide resolved
packages/query/src/graphql/graphql.module.ts Outdated Show resolved Hide resolved
@mpastecki
Copy link
Contributor Author

Thanks, updated.

@stwiname stwiname merged commit 68339ee into subquery:main Aug 11, 2024
2 of 3 checks passed
@mpastecki mpastecki deleted the improve-psql-connection-pool-handling branch August 12, 2024 07:14
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

Successfully merging this pull request may close these issues.

2 participants