Skip to content

Commit

Permalink
clientDecryptionExtensions, bugFix/perf improvement
Browse files Browse the repository at this point in the history
I have more and larger refactors coming, but this seemed useful to call out
participants includes left users, and instantiates a new set every time with joined, invited, and left users. And it is called inside a pretty hot loop.
I will optimize the hot loop in an upcoming pr
  • Loading branch information
texuf committed Oct 21, 2024
1 parent f50ee3a commit 35b98ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/sdk/src/clientDecryptionExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class ClientDecryptionExtensions extends BaseDecryptionExtensions {
const multiplier = userId === this.userId ? 0.5 : 1
const stream = this.client.stream(streamId)
check(isDefined(stream), 'stream not found')
const numMembers = stream.view.getMembers().participants().size
const numMembers = stream.view.getMembers().joinedParticipants().size
const maxWaitTimeSeconds = Math.max(5, Math.min(30, numMembers))
const waitTime = maxWaitTimeSeconds * 1000 * Math.random() // this could be much better
this.log.debug('getRespondDelayMSForKeySolicitation', { streamId, userId, waitTime })
Expand Down

0 comments on commit 35b98ce

Please sign in to comment.