Log app startup time

This commit is contained in:
Josh Perez 2021-01-15 12:30:58 -05:00 committed by Scott Nonnenberg
parent 8a72607fa7
commit bba50c8427
4 changed files with 12 additions and 1 deletions

View File

@ -866,6 +866,14 @@ function showPermissionsPopupWindow(forCalling, forCamera) {
// Some APIs can only be used after this event occurs.
let ready = false;
app.on('ready', async () => {
const startTime = Date.now();
// We use this event only a single time to log the startup time of the app
// from when it's first ready until the loading screen disappears.
ipc.once('signal-app-loaded', () => {
console.log('App has finished loading in:', Date.now() - startTime);
});
const userDataPath = await getRealPath(app.getPath('userData'));
const installPath = await getRealPath(app.getAppPath());

View File

@ -97,6 +97,8 @@ try {
window.setBadgeCount = count => ipc.send('set-badge-count', count);
window.logAppLoadedEvent = () => ipc.send('signal-app-loaded');
// We never do these in our code, so we'll prevent it everywhere
window.open = () => null;
// eslint-disable-next-line no-eval, no-multi-assign

View File

@ -2118,7 +2118,6 @@ type WhatIsThis = import('./window.d').WhatIsThis;
]);
window.log.info('onEmpty: All outstanding database requests complete');
initialLoadComplete = true;
window.readyForUpdates();
// Start listeners here, after we get through our queue.
@ -2140,6 +2139,7 @@ type WhatIsThis = import('./window.d').WhatIsThis;
clearInterval(interval!);
interval = null;
view.onEmpty();
window.logAppLoadedEvent();
}
}, 500);

1
ts/window.d.ts vendored
View File

@ -493,6 +493,7 @@ declare global {
hasSignalAccount: (number: string) => boolean;
getServerTrustRoot: () => WhatIsThis;
readyForUpdates: () => void;
logAppLoadedEvent: () => void;
// Flags
isGroupCallingEnabled: () => boolean;