File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed
Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -53,12 +53,9 @@ const LOOPBACK_ADDRESS = '127.0.0.1';
5353const LOOPBACK_HOSTNAME = 'localhost' ;
5454const LOOKUP_PORT_START = 8991 ;
5555const LOOKUP_PORT_END = 9000 ;
56-
5756const POLLING_INTERVAL = 1000 ;
58-
5957const CANT_FIND_AGENT_MESSAGE = 'Arduino Create Agent cannot be found' ;
6058let updateAttempts = 0 ;
61-
6259let orderedPluginAddresses = [ LOOPBACK_ADDRESS , LOOPBACK_HOSTNAME ] ;
6360
6461if ( browser . name !== 'chrome' && browser . name !== 'firefox' ) {
@@ -107,7 +104,7 @@ export default class SocketDaemon {
107104 this . _tryPorts ( orderedPluginAddresses [ 0 ] )
108105 . catch ( ( ) => this . _tryPorts ( orderedPluginAddresses [ 1 ] ) )
109106 . then ( ( ) => this . agentFound . next ( true ) )
110- . catch ( ( ) => timer ( POLLING_INTERVAL ) . subscribe ( ( ) => this . findAgent ( ) ) ) ;
107+ . catch ( ( ) => timer ( POLLING_INTERVAL ) . subscribe ( this . findAgent . bind ( this ) ) ) ;
111108 }
112109
113110 /**
@@ -153,7 +150,7 @@ export default class SocketDaemon {
153150 return this . update ( ) ;
154151 }
155152 if ( updateAttempts < 10 ) {
156- return setTimeout ( ( ) => this . update ( ) , 10000 ) ;
153+ return timer ( 10000 ) . subscribe ( this . update ( ) . bind ( this ) ) ;
157154 }
158155 }
159156 return Promise . reject ( new Error ( `${ CANT_FIND_AGENT_MESSAGE } at ${ hostname } ` ) ) ;
You can’t perform that action at this time.
0 commit comments