Log conversation open time

This commit is contained in:
Fedor Indutny 2022-01-19 16:40:29 -08:00 committed by GitHub
parent f1586578ff
commit 26421b8c18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 72 additions and 15 deletions

View file

@ -119,6 +119,8 @@ export class ConversationController {
private _initialPromise: undefined | Promise<void>;
private _conversationOpenStart = new Map<string, number>();
constructor(private _conversations: ConversationModelCollectionType) {}
get(id?: string | null): ConversationModel | undefined {
@ -754,6 +756,20 @@ export class ConversationController {
return this._initialPromise;
}
onConvoOpenStart(conversationId: string): void {
this._conversationOpenStart.set(conversationId, Date.now());
}
onConvoMessageMount(conversationId: string): void {
const loadStart = this._conversationOpenStart.get(conversationId);
if (loadStart === undefined) {
return;
}
this._conversationOpenStart.delete(conversationId);
this.get(conversationId)?.onOpenComplete(loadStart);
}
private async doLoad(): Promise<void> {
log.info('ConversationController: starting initial fetch');