Fix "Cannot Update" dialog's retry button

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2022-04-27 16:43:14 -07:00 committed by GitHub
parent 653e885266
commit 075b968cbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 3 deletions

View File

@ -180,6 +180,13 @@ export abstract class Updater {
const mainWindow = this.getMainWindow();
mainWindow?.webContents.send('show-update-dialog', dialogType);
this.setUpdateListener(async () => {
this.logger.info('updater/markCannotUpdate: retrying after user action');
this.markedCannotUpdate = false;
await this.checkForUpdatesMaybeInstall();
});
}
//

View File

@ -9,9 +9,10 @@ import * as packageJson from '../../package.json';
import { getUserAgent } from '../util/getUserAgent';
import * as durations from '../util/durations';
export const GOT_CONNECT_TIMEOUT = 5 * durations.MINUTE;
export const GOT_LOOKUP_TIMEOUT = 5 * durations.MINUTE;
export const GOT_SOCKET_TIMEOUT = 5 * durations.MINUTE;
export const GOT_CONNECT_TIMEOUT = durations.MINUTE;
export const GOT_LOOKUP_TIMEOUT = durations.MINUTE;
export const GOT_SOCKET_TIMEOUT = durations.MINUTE;
const GOT_RETRY_LIMIT = 3;
export function getProxyUrl(): string | undefined {
return process.env.HTTPS_PROXY || process.env.https_proxy;
@ -47,5 +48,19 @@ export function getGotOptions(): GotOptions {
// This timeout is reset whenever we get new data on the socket
socket: GOT_SOCKET_TIMEOUT,
},
retry: {
limit: GOT_RETRY_LIMIT,
errorCodes: [
'ETIMEDOUT',
'ECONNRESET',
'ECONNREFUSED',
'EPIPE',
'ENOTFOUND',
'ENETUNREACH',
'EAI_AGAIN',
],
methods: ['GET', 'HEAD'],
statusCodes: [413, 429, 503],
},
};
}