Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyBackup: Disable signalling remaining keys to upload count #4010

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/rust-crypto/backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,20 +342,29 @@ export class RustBackupManager extends TypedEventEmitter<RustBackupCryptoEvents,

if (!request || this.stopped || !this.activeBackupVersion) {
logger.log(`Backup: Ending loop for version ${this.activeBackupVersion}.`);
if (!request) {
// nothing more to upload
this.emit(CryptoEvent.KeyBackupSessionsRemaining, 0);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some test relies on this event to be fired at the end of the backup loop.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment should probably be in the code, not the PR.

}
return;
}

try {
await this.outgoingRequestProcessor.makeOutgoingRequest(request);
numFailures = 0;
if (this.stopped) break;
try {
const keyCount = await this.olmMachine.roomKeyCounts();
const remaining = keyCount.total - keyCount.backedUp;
this.emit(CryptoEvent.KeyBackupSessionsRemaining, remaining);
} catch (err) {
logger.error("Backup: Failed to get key counts from rust crypto-sdk", err);
}
// XXX: Due to performance issues when counting keys, we for now don't emit
// the number of remaining keys to back up (`CryptoEvent.KeyBackupSessionsRemaining`).
// We should re-enable this once the performance issues are fixed.
// see https://github.com/element-hq/element-web/issues/26783#issuecomment-1895318551
//
// try {
// const keyCount = await this.olmMachine.roomKeyCounts();
// const remaining = keyCount.total - keyCount.backedUp;
// this.emit(CryptoEvent.KeyBackupSessionsRemaining, remaining);
// } catch (err) {
// logger.error("Backup: Failed to get key counts from rust crypto-sdk", err);
// }
} catch (err) {
numFailures++;
logger.error("Backup: Error processing backup request for rust crypto-sdk", err);
Expand Down
Loading