File tree Expand file tree Collapse file tree 2 files changed +23
-11
lines changed
packages/compass/src/main Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -175,15 +175,13 @@ class CompassApplication {
175175
176176 await this . setupCORSBypass ( ) ;
177177 void this . setupCompassAuthService ( ) ;
178- if ( ! process . env . CI || process . env . HADRON_AUTO_UPDATE_ENDPOINT_OVERRIDE ) {
179- this . setupAutoUpdate ( ) ;
180- }
181178 await setupCSFLELibrary ( ) ;
182179 setupTheme ( this ) ;
183180 this . setupJavaScriptArguments ( ) ;
184181 this . setupLifecycleListeners ( ) ;
185182 this . setupApplicationMenu ( ) ;
186183 this . setupWindowManager ( ) ;
184+ this . setupAutoUpdate ( ) ;
187185 this . trackApplicationLaunched ( globalPreferences ) ;
188186 }
189187
@@ -213,7 +211,9 @@ class CompassApplication {
213211 }
214212
215213 private static setupAutoUpdate ( ) : void {
216- CompassAutoUpdateManager . init ( this ) ;
214+ if ( ! process . env . CI || process . env . HADRON_AUTO_UPDATE_ENDPOINT_OVERRIDE ) {
215+ void CompassAutoUpdateManager . init ( this ) ;
216+ }
217217 }
218218
219219 private static setupApplicationMenu ( ) : void {
Original file line number Diff line number Diff line change @@ -850,16 +850,28 @@ class CompassAutoUpdateManager {
850850 } )
851851 . then ( ( { response } ) => {
852852 if ( response === 0 ) {
853- const url = `https://compass.mongodb.com/api/v2/download/latest/compass/${ this . autoUpdateOptions . channel } /darwin-arm64` ;
854- void dl . download ( BrowserWindow . getAllWindows ( ) [ 0 ] , url ) ;
853+ return dl . download (
854+ BrowserWindow . getAllWindows ( ) [ 0 ] ,
855+ `https://compass.mongodb.com/api/v2/download/${ this . autoUpdateOptions . version } /compass/${ this . autoUpdateOptions . channel } /darwin-arm64`
856+ ) ;
855857 }
858+ } )
859+ . catch ( ( err ) => {
860+ log . warn (
861+ mongoLogId ( 1_001_000_362 ) ,
862+ 'AutoUpdateManager' ,
863+ 'Failed to download Compass for a mismatched macos arch' ,
864+ { error : err . message }
865+ ) ;
856866 } ) ;
857867 }
858868
859- private static _init (
869+ private static async _init (
860870 compassApp : typeof CompassApplication ,
861871 options : Partial < AutoUpdateManagerOptions > = { }
862- ) : void {
872+ ) : Promise < void > {
873+ await app . whenReady ( ) ;
874+
863875 this . fetch = ( url : string ) => compassApp . httpClient . fetch ( url ) ;
864876
865877 compassApp . addExitHandler ( ( ) => {
@@ -993,13 +1005,13 @@ class CompassAutoUpdateManager {
9931005 ) ;
9941006 }
9951007
996- static init (
1008+ static async init (
9971009 compassApp : typeof CompassApplication ,
9981010 options : Partial < AutoUpdateManagerOptions > = { }
999- ) : void {
1011+ ) : Promise < void > {
10001012 if ( ! this . initCalled ) {
10011013 this . initCalled = true ;
1002- this . _init ( compassApp , options ) ;
1014+ await this . _init ( compassApp , options ) ;
10031015 }
10041016 }
10051017
You can’t perform that action at this time.
0 commit comments