Skip to content

Commit 83775c3

Browse files
committed
Fix pending logs
1 parent 1109132 commit 83775c3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/log-stream.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ class LogStream extends Readable {
3333
};
3434

3535
let next = (_err, _data) => {
36+
this.pending = false;
3637
setTimeout(this._read.bind(this), this.options.durationBetweenPolls);
3738
};
3839

39-
this.pending = false;
4040
this.cloudwatchlogs.getLogEvents(params)
4141
.then((data) => {
42-
if (data && data.events.length > 0) {
42+
if (data) {
43+
if (!this.logsReceived) {
44+
this.logsReceived = data.events.length > 0
45+
}
46+
4347
this.nextToken = data.nextForwardToken;
44-
this.logsReceived = true;
4548
data.events.forEach((event) => this.eventBuffer.push(event));
4649
}
4750

0 commit comments

Comments
 (0)