File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -85,8 +85,10 @@ export default class RohrpostClient extends EventEmitter {
8585 this . socketState = 'closed'
8686 this . emit ( 'closed' ) // why past tense? because the socket is already closed and not currently closing
8787 if ( ! this . _normalClose ) {
88- this . emit ( 'reconnecting' )
89- this . _createSocket ( )
88+ setTimeout ( ( ) => {
89+ this . emit ( 'reconnecting' )
90+ this . _createSocket ( )
91+ } , 3000 ) // throttle reconnect
9092 }
9193 } )
9294
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ describe('Rohrpost Client', () => {
7373 it ( '… and reconnect' , ( done ) => {
7474 client . once ( 'open' , done )
7575 server . drop = false
76- } )
76+ } ) . timeout ( 5000 )
7777 it ( 'should automatically resubscribe' , ( done ) => {
7878 // TODO test this for real
7979 client . once ( 'collection-52' , ( err , data ) => {
@@ -93,7 +93,7 @@ describe('Rohrpost Client', () => {
9393 } )
9494 it ( '… and reconnect' , ( done ) => {
9595 client . once ( 'open' , done )
96- } )
96+ } ) . timeout ( 5000 )
9797 it ( 'should close itself' , ( done ) => {
9898 client . close ( )
9999 client . once ( 'closed' , done )
You can’t perform that action at this time.
0 commit comments