Skip to content

Commit 76a86fa

Browse files
committed
Solving issue in driver.close()
1 parent 8737df8 commit 76a86fa

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

bolt-connection/src/pool/pool.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,22 @@ class Pool {
134134
* Destroy all idle resources in this pool.
135135
* @returns {Promise<void>} A promise that is resolved when the resources are purged
136136
*/
137-
close () {
137+
async close () {
138138
this._closed = true
139-
return Promise.all(Object.keys(this._pools).map(key => this._purgeKey(key)))
139+
/**
140+
* The lack of Promise consuming was making the driver do not close properly in the scenario
141+
* captured at result.test.js:it('should handle missing onCompleted'). The test was timing out
142+
* because while wainting for the driver close.
143+
*
144+
* Consuming the Promise.all or by calling then or by awaiting in the result inside this method solved
145+
* the issue somehow.
146+
*
147+
* PS: the return of this method was already awaited at PooledConnectionProvider.close, but the await bellow
148+
* seems to be need also.
149+
*/
150+
return await Promise.all(
151+
Object.keys(this._pools).map(key => this._purgeKey(key))
152+
)
140153
}
141154

142155
/**

0 commit comments

Comments
 (0)