Initialize ConversationController earlier

This commit is contained in:
Scott Nonnenberg 2021-07-16 11:21:00 -07:00 committed by GitHub
parent aa63aabbc6
commit 8415db499c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -109,7 +109,9 @@ export async function cleanupSessionResets(): Promise<void> {
}
export async function startApp(): Promise<void> {
window.Whisper.events = window._.clone(window.Backbone.Events);
window.Signal.Util.MessageController.install();
window.Signal.conversationControllerStart();
window.startupProcessingQueue = new window.Signal.Util.StartupQueue();
window.attachmentDownloadQueue = [];
try {
@ -361,7 +363,6 @@ export async function startApp(): Promise<void> {
}
return SocketStatus.CLOSED;
};
window.Whisper.events = window._.clone(window.Backbone.Events);
let accountManager: typeof window.textsecure.AccountManager;
window.getAccountManager = () => {
if (!accountManager) {
@ -741,10 +742,14 @@ export async function startApp(): Promise<void> {
// How long since we were last running?
const lastHeartbeat = window.storage.get('lastHeartbeat', 0);
const previousLastStartup = window.storage.get('lastStartup');
await window.storage.put('lastStartup', Date.now());
const THIRTY_DAYS = 30 * 24 * 60 * 60 * 1000;
if (lastHeartbeat > 0 && isOlderThan(lastHeartbeat, THIRTY_DAYS)) {
window.log.warn(
`This instance has not been used for 30 days. Last heartbeat: ${lastHeartbeat}. Last startup: ${previousLastStartup}.`
);
await unlinkAndDisconnect();
}
@ -874,8 +879,6 @@ export async function startApp(): Promise<void> {
}
});
window.Signal.conversationControllerStart();
// We start this up before window.ConversationController.load() to
// ensure that our feature flags are represented in the cached props
// we generate on load of each convo.