Skip to content

Commit c933de8

Browse files
committed
feat(sap): add support for maxWaitTimeoutIfPoolExhausted
1 parent 47d1e25 commit c933de8

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ services:
116116
# sap hana
117117
# works only on linux, minimum 10GB RAM for docker required
118118
hanaexpress:
119-
image: "saplabs/hanaexpress:2.00.076.00.20240701.1"
119+
image: "saplabs/hanaexpress:2.00.088.00.20251110.1"
120120
container_name: "typeorm-hanaexpress"
121121
hostname: hxe
122122
command:
123123
[
124+
"--agree-to-sap-license",
124125
"--passwords-url",
125126
"file:////hana/hxe-config.json",
126-
"--agree-to-sap-license",
127127
]
128128
ulimits:
129129
nofile: 1048576

docs/docs/drivers/sap.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ See [Data Source Options](../data-source/2-data-source-options.md) for the commo
2525
- `pool` — Connection pool configuration object:
2626
- `maxConnectedOrPooled` (number) — Max active or idle connections in the pool (default: 10).
2727
- `maxPooledIdleTime` (seconds) — Time before an idle connection is closed (default: 30).
28+
- `maxWaitTimeoutIfPoolExhausted` (milliseconds) - Time to wait for a connection to become available (default: 0, no wait). Requires `@sap/hana-client` version `2.27` or later.
2829
- `pingCheck` (boolean) — Whether to validate connections before use (default: false).
2930
- `poolCapacity` (number) — Maximum number of connections to be kept available (default: no limit).
3031

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"devDependencies": {
115115
"@eslint/js": "^9.39.1",
116116
"@google-cloud/spanner": "^8.3.1",
117-
"@sap/hana-client": "^2.26.26",
117+
"@sap/hana-client": "^2.27.19",
118118
"@tsconfig/node16": "^16.1.8",
119119
"@types/chai": "^4.3.20",
120120
"@types/chai-as-promised": "^7.1.8",

src/driver/sap/SapConnectionOptions.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ export interface SapConnectionOptions
4545
*/
4646
readonly maxPooledIdleTime?: number
4747

48+
/**
49+
* Defines the maximum time, in milliseconds, to wait for a connection
50+
* to become available once the specified number of `maxConnectedOrPooled`
51+
* open connections have been reached (default: 0, no wait).
52+
* @remarks Requires `@sap/hana-client` version `2.27` or later.
53+
*/
54+
readonly maxWaitTimeoutIfPoolExhausted?: number
55+
4856
/**
4957
* Determines whether or not the pooled connection should be tested for
5058
* viability before being reused (default: false).
@@ -77,7 +85,7 @@ export interface SapConnectionOptions
7785

7886
/**
7987
* Max milliseconds a request will wait for a resource before timing out.
80-
* @deprecated Obsolete, no alternative exists.
88+
* @deprecated Use {@link maxWaitTimeoutIfPoolExhausted} instead.
8189
*/
8290
readonly requestTimeout?: number
8391

src/driver/sap/SapDriver.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ export class SapDriver implements Driver {
291291
(this.options.pool?.idleTimeout
292292
? this.options.pool.idleTimeout / 1000
293293
: 30),
294+
maxWaitTimeoutIfPoolExhausted:
295+
this.options.pool?.maxWaitTimeoutIfPoolExhausted ??
296+
this.options.pool?.requestTimeout,
294297
}
295298
if (this.options.pool?.pingCheck) {
296299
poolOptions.pingCheck = this.options.pool.pingCheck

0 commit comments

Comments
 (0)