Skip to content

Commit

Permalink
fix: postgres plugin blocking call (#36046)
Browse files Browse the repository at this point in the history
## Description
This PR resolves the blockhound callout `Blocking call!
java.io.FileInputStream#readBytes` in the /v1/actions/execute (POST) API
call when used with Postgres Plugin.
This blocking call was present in the PostgresPlugin.java

Fixes #36008   

## Automation

/ok-to-test tags="@tag.Sanity"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!IMPORTANT]
> 🟣 🟣 🟣 Your tests are running.
> Tests running at:
<https://github.com/appsmithorg/appsmith/actions/runs/10666128697>
> Commit: 9224297
> Workflow: `PR Automation test suite`
> Tags: `@tag.Sanity`
> Spec: ``
> <hr>Mon, 02 Sep 2024 11:19:10 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **Chores**
- Improved the readability and conciseness of the connection pool
creation logic in the Postgres plugin, enhancing maintainability without
affecting functionality.
- Updated logging level from debug to info for better clarity on log
messages.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
NilanshBansal authored Sep 2, 2024
1 parent bd8c0de commit 4516129
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -654,15 +654,11 @@ public Mono<HikariDataSource> datasourceCreate(DatasourceConfiguration datasourc
e.getMessage()));
}

return connectionPoolConfig
.getMaxConnectionPoolSize()
.flatMap(maxPoolSize -> {
return Mono.fromCallable(() -> {
log.debug("Connecting to Postgres db");
return createConnectionPool(datasourceConfiguration, maxPoolSize);
});
return connectionPoolConfig.getMaxConnectionPoolSize().flatMap(maxPoolSize -> Mono.fromCallable(() -> {
log.info("Connecting to Postgres db");
return createConnectionPool(datasourceConfiguration, maxPoolSize);
})
.subscribeOn(scheduler);
.subscribeOn(scheduler));
}

@Override
Expand Down

0 comments on commit 4516129

Please sign in to comment.