@@ -37,15 +37,22 @@ export class UpdateService extends AbstractUpdateService {
37
37
super ( null , configurationService , environmentService , requestService , logService ) ;
38
38
}
39
39
40
+ /**
41
+ * Return true if the currently installed version is the latest.
42
+ */
40
43
public async isLatestVersion ( latest ?: IUpdate | null ) : Promise < boolean | undefined > {
41
44
if ( ! latest ) {
42
45
latest = await this . getLatestVersion ( ) ;
43
46
}
44
47
if ( latest ) {
45
48
const latestMajor = parseInt ( latest . name ) ;
46
49
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 ;
49
56
}
50
57
return true ;
51
58
}
@@ -62,7 +69,7 @@ export class UpdateService extends AbstractUpdateService {
62
69
this . setState ( State . CheckingForUpdates ( context ) ) ;
63
70
try {
64
71
const update = await this . getLatestVersion ( ) ;
65
- if ( ! update || this . isLatestVersion ( update ) ) {
72
+ if ( ! update || await this . isLatestVersion ( update ) ) {
66
73
this . setState ( State . Idle ( UpdateType . Archive ) ) ;
67
74
} else {
68
75
this . setState ( State . AvailableForDownload ( {
0 commit comments