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';
53
53
const LOOPBACK_HOSTNAME = 'localhost' ;
54
54
const LOOKUP_PORT_START = 8991 ;
55
55
const LOOKUP_PORT_END = 9000 ;
56
-
57
56
const POLLING_INTERVAL = 1000 ;
58
-
59
57
const CANT_FIND_AGENT_MESSAGE = 'Arduino Create Agent cannot be found' ;
60
58
let updateAttempts = 0 ;
61
-
62
59
let orderedPluginAddresses = [ LOOPBACK_ADDRESS , LOOPBACK_HOSTNAME ] ;
63
60
64
61
if ( browser . name !== 'chrome' && browser . name !== 'firefox' ) {
@@ -107,7 +104,7 @@ export default class SocketDaemon {
107
104
this . _tryPorts ( orderedPluginAddresses [ 0 ] )
108
105
. catch ( ( ) => this . _tryPorts ( orderedPluginAddresses [ 1 ] ) )
109
106
. then ( ( ) => this . agentFound . next ( true ) )
110
- . catch ( ( ) => timer ( POLLING_INTERVAL ) . subscribe ( ( ) => this . findAgent ( ) ) ) ;
107
+ . catch ( ( ) => timer ( POLLING_INTERVAL ) . subscribe ( this . findAgent . bind ( this ) ) ) ;
111
108
}
112
109
113
110
/**
@@ -153,7 +150,7 @@ export default class SocketDaemon {
153
150
return this . update ( ) ;
154
151
}
155
152
if ( updateAttempts < 10 ) {
156
- return setTimeout ( ( ) => this . update ( ) , 10000 ) ;
153
+ return timer ( 10000 ) . subscribe ( this . update ( ) . bind ( this ) ) ;
157
154
}
158
155
}
159
156
return Promise . reject ( new Error ( `${ CANT_FIND_AGENT_MESSAGE } at ${ hostname } ` ) ) ;
You can’t perform that action at this time.
0 commit comments