336
337
private saveState(): void {
339
return;
340
}
342
>
const liveLocalChats = Array.from(this._sessionModels.values())
343
>
.filter(session => this.shouldStoreSession(session));
344
>
345
>
const liveNonLocalChats = Array.from(this._sessionModels.values())
346
>
.filter(session => !LocalChatSessionUri.parseLocalSessionId(session.sessionResource));
347
>
348
>
// Synchronously update the index for all live sessions and flush it to
349
>
// storage. This is critical because `onWillSaveState` is synchronous —
350
>
// after this handler returns the storage service flushes its databases.
351
>
// The async file-write work kicked off below may complete after the
352
>
// flush, but the index must be up-to-date before the flush happens so
353
>
// that sessions are discoverable after a reload.
354
>
this._chatSessionStore.updateAndFlushIndexSync(liveLocalChats, liveNonLocalChats);
355
>
356
>
// Kick off async file writes for session data.
357
>
this._chatSessionStore.storeSessions(liveLocalChats);
358
>
this._chatSessionStore.storeSessionsMetadataOnly(liveNonLocalChats);
359
>
}
360
361
/**