Initialize `locale` earlier to avoid races

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2021-11-29 10:23:26 -08:00 committed by GitHub
parent b4b899c695
commit 06eb53561f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -1371,6 +1371,12 @@ app.on('ready', async () => {
logger = await logging.initialize(getMainWindow);
if (!locale) {
const appLocale =
getEnvironment() === Environment.Test ? 'en' : app.getLocale();
locale = loadLocale({ appLocale, logger });
}
sqlInitPromise = initializeSQL(userDataPath);
const startTime = Date.now();
@ -1448,12 +1454,6 @@ app.on('ready', async () => {
);
}
if (!locale) {
const appLocale =
getEnvironment() === Environment.Test ? 'en' : app.getLocale();
locale = loadLocale({ appLocale, logger });
}
GlobalErrors.updateLocale(locale.messages);
// If the sql initialization takes more than three seconds to complete, we