GoogleCloudPlatform / genai-databases-retrieval-app

Apache License 2.0
212 stars 72 forks source link

fix: use lazy refresh for AlloyDB and Cloud SQL Connector #429

Closed jackwotherspoon closed 4 months ago

jackwotherspoon commented 4 months ago

The Cloud SQL Python Connector just released a new version v1.10.0, same with AlloyDB Python Connector v1.2.0 that support setting the refresh_strategy argument of the connector.

Setting the refresh strategy to lazy refresh is recommended for serverless environments. As the default refresh strategy is to have background refreshes occur to get the instance metadata and a fresh certificate to use for the SSL/TLS connection.

However, these background refreshes can be throttled when serverless environments scale to zero (Cloud Functions, Cloud Run etc.).

This PR will fix the ambiguous errors that are a result of the CPU being throttled for connectors.

jackwotherspoon commented 4 months ago

@Yuan325 @averikitsch mind taking a look at this 😄