Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit baa9b5f

Browse filesBrowse files
author
Alberto Iannaccone
authored
Automatically check for updates only once (arduino#863)
* Automatically check for updates only once * set windows version to 2019 on CI
1 parent 481497e commit baa9b5f
Copy full SHA for baa9b5f

File tree

Expand file treeCollapse file tree

5 files changed

+17
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

5 files changed

+17
-9
lines changed
Open diff view settings
Collapse file

‎.github/workflows/build.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/build.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
matrix:
2525
config:
26-
- os: windows-latest
26+
- os: windows-2019
2727
- os: ubuntu-18.04 # https://github.com/arduino/arduino-ide/issues/259
2828
- os: macos-latest
2929
runs-on: ${{ matrix.config.os }}
Collapse file

‎arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx‎

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ export class ArduinoFrontendContribution
282282
this.updaterService.init(
283283
this.arduinoPreferences.get('arduino.ide.updateChannel')
284284
);
285-
this.updater.checkForUpdates().then(async (updateInfo) => {
285+
this.updater.checkForUpdates(true).then(async (updateInfo) => {
286286
if (!updateInfo) return;
287287
const versionToSkip = await this.localStorageService.getData<string>(
288288
SKIP_IDE_VERSION
Collapse file

‎arduino-ide-extension/src/browser/ide-updater/ide-updater-commands.ts‎

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/browser/ide-updater/ide-updater-commands.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export class IDEUpdaterCommands implements CommandContribution {
3131
});
3232
}
3333

34-
async checkForUpdates(): Promise<UpdateInfo | void> {
35-
return await this.updater.checkForUpdates();
34+
async checkForUpdates(initialCheck?: boolean): Promise<UpdateInfo | void> {
35+
return await this.updater.checkForUpdates(initialCheck);
3636
}
3737

3838
async downloadUpdate(): Promise<void> {
Collapse file

‎arduino-ide-extension/src/common/protocol/ide-updater.ts‎

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/common/protocol/ide-updater.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const IDEUpdaterPath = '/services/ide-updater';
4747
export const IDEUpdater = Symbol('IDEUpdater');
4848
export interface IDEUpdater extends JsonRpcServer<IDEUpdaterClient> {
4949
init(channel: UpdateChannel): void;
50-
checkForUpdates(): Promise<UpdateInfo | void>;
50+
checkForUpdates(initialCheck?: boolean): Promise<UpdateInfo | void>;
5151
downloadUpdate(): Promise<void>;
5252
quitAndInstall(): void;
5353
stopDownload(): void;
Collapse file

‎arduino-ide-extension/src/electron-main/ide-updater/ide-updater-impl.ts‎

Copy file name to clipboardExpand all lines: arduino-ide-extension/src/electron-main/ide-updater/ide-updater-impl.ts
+12-4Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ const IDE_DOWNLOAD_BASE_URL = 'https://downloads.arduino.cc/arduino-ide';
1212

1313
@injectable()
1414
export class IDEUpdaterImpl implements IDEUpdater {
15+
private isAlreadyChecked = false;
1516
private updater = autoUpdater;
1617
private cancellationToken?: CancellationToken;
1718
protected theiaFEClient?: IDEUpdaterClient;
1819
protected clients: Array<IDEUpdaterClient> = [];
1920

20-
init(channel: UpdateChannel) {
21+
init(channel: UpdateChannel): void {
2122
this.updater.autoDownload = false;
2223
this.updater.channel = channel;
2324
this.updater.setFeedURL({
@@ -52,9 +53,16 @@ export class IDEUpdaterImpl implements IDEUpdater {
5253
if (client) this.clients.push(client);
5354
}
5455

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();
5866

5967
this.cancellationToken = cancellationToken;
6068
if (this.updater.currentVersion.compare(updateInfo.version) === -1) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.