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

rework connection pool #607

Merged
merged 2 commits into from
Apr 8, 2024
Merged

rework connection pool #607

merged 2 commits into from
Apr 8, 2024

Conversation

lpatte
Copy link
Contributor

@lpatte lpatte commented Apr 5, 2024

Description

  • Rework Postgresql Connection Pool
    • Add retry on create
    • Add some input verif
    • Add a list Datasource
  • Add context in some call

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (improve existing resource(s) or datasource(s))
  • Documentation update

log.Printf("[DEBUG] Will create connection pool: %+v for cluster %s from project %s", params, clusterID, serviceName)
rErr := config.OVHClient.PostWithContext(ctx, endpoint, params, res)
if rErr != nil {
if errOvh, ok := rErr.(*ovh.APIError); ok && (errOvh.Code == 403) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we want to retry in case of a 403 ? I think this deserves a comment as it's kind of weird

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this is the error code when the database is not create yet :
OVHcloud API error (status code 403): Client::Forbidden::BadRequest: {"errors":[{"message":"Service database 'mydatabase' does not exist","status":403}],"message":"Service database 'mydatabase' does not exist"}

output "connection_pool_ids" {
value = data.ovh_cloud_project_database_postgresql_connection_pools.test_pools.connection_pool_ids
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

@amstuta amstuta merged commit 39768c5 into master Apr 8, 2024
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