Skip to content

Commit

Permalink
Fix db connection pool exhausting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
SavinduDimal committed Sep 23, 2024
1 parent cebaf7a commit 8f7a8c4
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14720,13 +14720,12 @@ private List<Object> buildUpdateParams(LLMProvider provider) {
public LLMProvider getLLMProvider(String organization, String llmProviderId) throws APIManagementException {

String errorMessage = "Failed to get LLM Provider in tenant domain: " + organization;
try {
Connection connection = APIMgtDBUtil.getConnection();
String getLlmProviderSql = SQLConstants.GET_LLM_PROVIDER_SQL;
if (organization != null) {
getLlmProviderSql += " AND ORGANIZATION = ?";
}
PreparedStatement preparedStatement = connection.prepareStatement(getLlmProviderSql);
String getLlmProviderSql = SQLConstants.GET_LLM_PROVIDER_SQL;
if (organization != null) {
getLlmProviderSql += " AND ORGANIZATION = ?";
}
try (Connection connection = APIMgtDBUtil.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(getLlmProviderSql)) {
preparedStatement.setString(1, llmProviderId);
if (organization != null) {
preparedStatement.setString(2, organization);
Expand Down

0 comments on commit 8f7a8c4

Please sign in to comment.