diff --git a/ts/updater/common.ts b/ts/updater/common.ts index 0d0b294a8..5d1df1f1f 100644 --- a/ts/updater/common.ts +++ b/ts/updater/common.ts @@ -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(); + }); } // diff --git a/ts/updater/got.ts b/ts/updater/got.ts index c85e83121..9dfe6fa0d 100644 --- a/ts/updater/got.ts +++ b/ts/updater/got.ts @@ -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], + }, }; }