Skip to content

Commit d686334

Browse files
author
diego Dupin
committed
[misc] update streaming configuration emphasis closing queryStream
1 parent fa814e3 commit d686334

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

documentation/promise-api.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,8 +801,12 @@ simple use with for-await-of only available since Node.js 10 (note that this mus
801801
```javascript
802802
async function streamingFunction() {
803803
const queryStream = connection.queryStream('SELECT * FROM mysql.user');
804-
for await (const row of queryStream) {
805-
console.log(row);
804+
try {
805+
for await (const row of queryStream) {
806+
console.log(row);
807+
}
808+
} catch (e) {
809+
queryStream.close();
806810
}
807811
}
808812
```

0 commit comments

Comments
 (0)