Introduce versioning clock to timer system

This commit is contained in:
Fedor Indutny
2024-08-21 09:03:28 -07:00
committed by GitHub
parent bb1d957e49
commit 2fb50df0af
34 changed files with 703 additions and 28 deletions

View File

@@ -1070,6 +1070,23 @@ export class ConversationController {
}
current.set('active_at', activeAt);
current.set(
'expireTimerVersion',
Math.max(
obsolete.get('expireTimerVersion') ?? 1,
current.get('expireTimerVersion') ?? 1
)
);
const obsoleteExpireTimer = obsolete.get('expireTimer');
const currentExpireTimer = current.get('expireTimer');
if (
!currentExpireTimer ||
(obsoleteExpireTimer && obsoleteExpireTimer < currentExpireTimer)
) {
current.set('expireTimer', obsoleteExpireTimer);
}
const currentHadMessages = (current.get('messageCount') ?? 0) > 0;
const dataToCopy: Partial<ConversationAttributesType> = pick(