Skip to content

Commit 206b1e2

Browse files
author
Stefania
committed
improved update, Fixes #29
1 parent a765aa3 commit 206b1e2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/socket-daemon.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@ export default class SocketDaemon extends Daemon {
7676

7777
this.agentFound
7878
.subscribe(agentFound => {
79-
if (agentFound) {
80-
this._wsConnect();
81-
}
82-
else {
79+
if (!agentFound) {
8380
this.findAgent();
8481
}
8582
});
@@ -147,14 +144,17 @@ export default class SocketDaemon extends Daemon {
147144

148145
if (found) {
149146
if (this.agentInfo.version && (semVerCompare(this.agentInfo.version, MIN_VERSION) >= 0 || this.agentInfo.version.indexOf('dev') !== -1)) {
147+
this._wsConnect();
150148
return this.agentInfo;
151149
}
152150

151+
this.channelOpen.next(false);
152+
153153
updateAttempts += 1;
154154
if (updateAttempts === 0) {
155155
return this.update();
156156
}
157-
if (updateAttempts < 6) {
157+
if (updateAttempts < 5) {
158158
return timer(10000).subscribe(() => this.update());
159159
}
160160
return this.error.next('plugin version incompatible');

0 commit comments

Comments
 (0)