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

Sign up
Appearance settings

Commit baa9b5f

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

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

‎.github/workflows/build.yml‎

Lines 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 }}

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

Lines 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

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

Lines 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> {

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

Lines 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;

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

Lines 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)

AltStyle によって変換されたページ (->オリジナル) /