Skip to content

Commit 6ea1b4a

Browse files
author
Stefania
committed
improved error subject
1 parent 4d8093e commit 6ea1b4a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/daemon.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020

2121
import { Subject, BehaviorSubject, interval } from 'rxjs';
22-
import { takeUntil, filter, startWith, first } from 'rxjs/operators';
22+
import { takeUntil, filter, startWith, first, distinctUntilChanged } from 'rxjs/operators';
2323

2424
const POLLING_INTERVAL = 1500;
2525

@@ -33,7 +33,7 @@ export default class Daemon {
3333
this.agentInfo = {};
3434
this.agentFound = new BehaviorSubject(null);
3535
this.channelOpen = new BehaviorSubject(null);
36-
this.error = new BehaviorSubject(null);
36+
this.error = new BehaviorSubject(null).pipe(distinctUntilChanged());
3737

3838
this.appMessages = new Subject();
3939
this.serialMonitorOpened = new BehaviorSubject(false);

src/socket-daemon.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export default class SocketDaemon extends Daemon {
154154
if (updateAttempts === 0) {
155155
return this.update();
156156
}
157-
if (updateAttempts < 4) {
157+
if (updateAttempts < 3) {
158158
return timer(10000).subscribe(() => this.update());
159159
}
160160
this.error.next('plugin version incompatible');
@@ -260,7 +260,9 @@ export default class SocketDaemon extends Daemon {
260260
// We reject the promise because the daemon will be restarted, we need to continue looking for the port
261261
return Promise.reject();
262262
})
263-
.catch(err => Promise.reject(err));
263+
.catch(() => {
264+
console.log('update plugin failed');
265+
});
264266
}
265267

266268
/**

0 commit comments

Comments
 (0)