Flush last conversation message save on shutdown
This commit is contained in:
parent
0ccbf5e4bd
commit
42108c9ca9
3 changed files with 35 additions and 8 deletions
|
@ -658,6 +658,17 @@ export async function startApp(): Promise<void> {
|
|||
await window.waitForAllBatchers();
|
||||
}
|
||||
|
||||
log.info('background/shutdown: flushing conversations');
|
||||
|
||||
// Flush debounced updates for conversations
|
||||
await Promise.all(
|
||||
window.ConversationController.getAll().map(convo =>
|
||||
convo.flushDebouncedUpdates()
|
||||
)
|
||||
);
|
||||
|
||||
log.info('background/shutdown: waiting for all batchers');
|
||||
|
||||
// A number of still-to-queue database queries might be waiting inside batchers.
|
||||
// We wait for these to empty first, and then shut down the data interface.
|
||||
await Promise.all([
|
||||
|
@ -665,6 +676,8 @@ export async function startApp(): Promise<void> {
|
|||
window.waitForAllWaitBatchers(),
|
||||
]);
|
||||
|
||||
log.info('background/shutdown: closing the database');
|
||||
|
||||
// Shut down the data interface cleanly
|
||||
await window.Signal.Data.shutdown();
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue