File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -134,9 +134,22 @@ class Pool {
134
134
* Destroy all idle resources in this pool.
135
135
* @returns {Promise<void> } A promise that is resolved when the resources are purged
136
136
*/
137
- close ( ) {
137
+ async close ( ) {
138
138
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
+ )
140
153
}
141
154
142
155
/**
You can’t perform that action at this time.
0 commit comments