Skip to content

Commit

Permalink
runfix: update epoch number locally on epoch change (#17048)
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrykBuniX authored Mar 11, 2024
1 parent 3f2d532 commit 0d4f305
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class MLSConversationVerificationStateHandler {
const conversations = this.conversationState.conversations();
await Promise.all(conversations.map(conversation => this.checkConversationVerificationState(conversation)));
};
private onEpochChanged = async ({groupId}: {groupId: string}): Promise<void> => {
private onEpochChanged = async ({groupId, epoch: newEpoch}: {groupId: string; epoch: number}): Promise<void> => {
// There could be a race condition where we would receive an epoch update for a conversation that is not yet known by the webapp.
// We just wait for it to be available and then check the verification state
const conversation = await waitFor(() =>
Expand All @@ -193,6 +193,7 @@ class MLSConversationVerificationStateHandler {
return this.logger.warn(`Epoch changed but conversation could not be found after waiting for 5 seconds`);
}

conversation.epoch = Number(newEpoch);
return this.checkConversationVerificationState(conversation);
};

Expand Down

0 comments on commit 0d4f305

Please sign in to comment.