Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fc3acfa

Browse files
committedOct 30, 2019
Fix update check
1 parent 3d5db83 commit fc3acfa

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed
 

‎src/node/update.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,22 @@ export class UpdateService extends AbstractUpdateService {
3737
super(null, configurationService, environmentService, requestService, logService);
3838
}
3939

40+
/**
41+
* Return true if the currently installed version is the latest.
42+
*/
4043
public async isLatestVersion(latest?: IUpdate | null): Promise<boolean | undefined> {
4144
if (!latest) {
4245
latest = await this.getLatestVersion();
4346
}
4447
if (latest) {
4548
const latestMajor = parseInt(latest.name);
4649
const currentMajor = parseInt(product.codeServerVersion);
47-
return !isNaN(latestMajor) && !isNaN(currentMajor) &&
48-
currentMajor <= latestMajor && latest.name === product.codeServerVersion;
50+
// If these are invalid versions we can't compare meaningfully.
51+
return isNaN(latestMajor) || isNaN(currentMajor) ||
52+
// This can happen when there is a pre-release for a new major version.
53+
currentMajor > latestMajor ||
54+
// Otherwise assume that if it's not the same then we're out of date.
55+
latest.name === product.codeServerVersion;
4956
}
5057
return true;
5158
}
@@ -62,7 +69,7 @@ export class UpdateService extends AbstractUpdateService {
6269
this.setState(State.CheckingForUpdates(context));
6370
try {
6471
const update = await this.getLatestVersion();
65-
if (!update || this.isLatestVersion(update)) {
72+
if (!update || await this.isLatestVersion(update)) {
6673
this.setState(State.Idle(UpdateType.Archive));
6774
} else {
6875
this.setState(State.AvailableForDownload({

0 commit comments

Comments
 (0)
Please sign in to comment.