bellboy 8.7.7 → 8.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,10 +13,23 @@ class PostgresProcessor extends database_processor_1.DatabaseProcessor {
13
13
  async process(processStream) {
14
14
  const query = new QueryStream(this.query);
15
15
  const db = await (0, utils_1.getDb)(this.connection, 'postgres');
16
- const dbConnection = await db.connect();
17
- const stream = dbConnection.client.query(query);
18
- await processStream(stream);
19
- dbConnection.done();
16
+ let dbConnection;
17
+ let stream;
18
+ try {
19
+ dbConnection = await db.connect();
20
+ stream = dbConnection.client.query(query);
21
+ await processStream(stream);
22
+ }
23
+ catch (err) {
24
+ try {
25
+ stream?.destroy();
26
+ }
27
+ catch (_) { }
28
+ throw err;
29
+ }
30
+ finally {
31
+ dbConnection?.done();
32
+ }
20
33
  }
21
34
  }
22
35
  exports.PostgresProcessor = PostgresProcessor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bellboy",
3
- "version": "8.7.7",
3
+ "version": "8.7.8",
4
4
  "description": "Highly performant JavaScript data stream ETL engine.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index",