File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ function startServer() {
8686 return ( data ) => {
8787 s += data ;
8888 if ( ! sender ) {
89- sender = setTimeout ( ( ) => {
89+ sender = queueMicrotask ( ( ) => {
9090 socket . send ( s ) ;
9191 s = '' ;
9292 sender = null ;
@@ -103,7 +103,7 @@ function startServer() {
103103 buffer . push ( data ) ;
104104 length += data . length ;
105105 if ( ! sender ) {
106- sender = setTimeout ( ( ) => {
106+ sender = queueMicrotask ( ( ) => {
107107 socket . send ( Buffer . concat ( buffer , length ) ) ;
108108 buffer = [ ] ;
109109 sender = null ;
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ export class WriteBuffer {
105105 // schedule chunk processing for next event loop run
106106 if ( ! this . _writeBuffer . length ) {
107107 this . _bufferOffset = 0 ;
108- setTimeout ( ( ) => this . _innerWrite ( ) ) ;
108+ queueMicrotask ( ( ) => this . _innerWrite ( ) ) ;
109109 }
110110
111111 this . _pendingData += data . length ;
@@ -217,7 +217,7 @@ export class WriteBuffer {
217217 this . _callbacks = this . _callbacks . slice ( this . _bufferOffset ) ;
218218 this . _bufferOffset = 0 ;
219219 }
220- setTimeout ( ( ) => this . _innerWrite ( ) ) ;
220+ queueMicrotask ( ( ) => this . _innerWrite ( ) ) ;
221221 } else {
222222 this . _writeBuffer . length = 0 ;
223223 this . _callbacks . length = 0 ;
You can’t perform that action at this time.
0 commit comments