@@ -12,12 +12,13 @@ const IDE_DOWNLOAD_BASE_URL = 'https://downloads.arduino.cc/arduino-ide';
12
12
13
13
@injectable ( )
14
14
export class IDEUpdaterImpl implements IDEUpdater {
15
+ private isAlreadyChecked = false ;
15
16
private updater = autoUpdater ;
16
17
private cancellationToken ?: CancellationToken ;
17
18
protected theiaFEClient ?: IDEUpdaterClient ;
18
19
protected clients : Array < IDEUpdaterClient > = [ ] ;
19
20
20
- init ( channel : UpdateChannel ) {
21
+ init ( channel : UpdateChannel ) : void {
21
22
this . updater . autoDownload = false ;
22
23
this . updater . channel = channel ;
23
24
this . updater . setFeedURL ( {
@@ -52,9 +53,16 @@ export class IDEUpdaterImpl implements IDEUpdater {
52
53
if ( client ) this . clients . push ( client ) ;
53
54
}
54
55
55
- async checkForUpdates ( ) : Promise < UpdateInfo | void > {
56
- const { updateInfo, cancellationToken } =
57
- await this . updater . checkForUpdates ( ) ;
56
+ async checkForUpdates ( initialCheck ?: boolean ) : Promise < UpdateInfo | void > {
57
+ if ( initialCheck ) {
58
+ if ( this . isAlreadyChecked ) return Promise . resolve ( ) ;
59
+ this . isAlreadyChecked = true ;
60
+ }
61
+
62
+ const {
63
+ updateInfo,
64
+ cancellationToken,
65
+ } = await this . updater . checkForUpdates ( ) ;
58
66
59
67
this . cancellationToken = cancellationToken ;
60
68
if ( this . updater . currentVersion . compare ( updateInfo . version ) === - 1 ) {
0 commit comments