Skip to content

Commit 8a40398

Browse files
authored
Update stream-consumer.js
1 parent 309cdbd commit 8a40398

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

examples/stream-consumer.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async function streamConsumer() {
1616
commandOptions({
1717
isolated: true
1818
}), [
19-
// XREAD can read from multiple streams, starting at a
19+
// XREAD can read from multiple streams, starting at a
2020
// different ID for each...
2121
{
2222
key: 'mystream',
@@ -33,7 +33,7 @@ async function streamConsumer() {
3333
// Response is an array of streams, each containing an array of
3434
// entries:
3535
// [
36-
// {
36+
// {
3737
// "name": "mystream",
3838
// "messages": [
3939
// {
@@ -49,17 +49,16 @@ async function streamConsumer() {
4949

5050
// Get the ID of the first (only) entry returned.
5151
currentId = response[0].messages[0].id;
52-
console.log(currentId);
52+
console.log(currentId);
5353
} else {
54-
// Response is null, we have read everything that is
54+
// Response is null, we have read everything that is
5555
// in the stream right now...
5656
console.log('No new stream entries.');
5757
}
58+
} catch (err) {
59+
console.error(err);
5860
}
59-
} catch (err) {
60-
console.error(err);
6161
}
6262
}
6363

6464
streamConsumer();
65-

0 commit comments

Comments
 (0)