Skip to content

Commit 88006ac

Browse files
committed
Make sure to wait for the previous flush on end()
1 parent ab842b9 commit 88006ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/connection/embedded_connection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ export class EmbeddedConnection implements Connection {
2424
if (len === 1) {
2525
// we are the first in line, therefore we schedule a flush,
2626
// BUT we must wait for the previous flush to end.
27-
//
2827
this.flushing = this.flushing.then(() => this.scheduleFlush());
2928
}
3029
// tag along to the previously scheduled flush.
3130
return this.flushing;
3231
}
3332

3433
end(): Promise<void> {
35-
return this.flush();
34+
this.flushing = this.flushing.then(() => this.flush());
35+
return this.flushing;
3636
}
3737

3838
private scheduleFlush(): Promise<void> {

0 commit comments

Comments
 (0)