1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

Schedule key upload on enabling backup

This ensures a partially completed backup will continue to make progress.
This commit is contained in:
J. Ryan Stinnett
2019-01-08 18:17:46 -06:00
parent 0cbced43bd
commit 5cfd082b00
2 changed files with 6 additions and 2 deletions

View File

@@ -843,6 +843,10 @@ MatrixClient.prototype.enableKeyBackup = function(info) {
this._crypto.backupKey.set_recipient_key(info.auth_data.public_key); this._crypto.backupKey.set_recipient_key(info.auth_data.public_key);
this.emit('crypto.keyBackupStatus', true); this.emit('crypto.keyBackupStatus', true);
// There may be keys left over from a partially completed backup, so
// schedule a send to check.
this._crypto.scheduleKeyBackupSend();
}; };
/** /**

View File

@@ -989,7 +989,7 @@ Crypto.prototype.importRoomKeys = function(keys) {
* Schedules sending all keys waiting to be sent to the backup, if not already * Schedules sending all keys waiting to be sent to the backup, if not already
* scheduled. Retries if necessary. * scheduled. Retries if necessary.
*/ */
Crypto.prototype._scheduleKeyBackupSend = async function() { Crypto.prototype.scheduleKeyBackupSend = async function() {
if (this._sendingBackups) return; if (this._sendingBackups) return;
try { try {
@@ -1115,7 +1115,7 @@ Crypto.prototype.backupGroupSession = async function(
// don't wait for this to complete: it will delay so // don't wait for this to complete: it will delay so
// happens in the background // happens in the background
this._scheduleKeyBackupSend(); this.scheduleKeyBackupSend();
}; };
Crypto.prototype.backupAllGroupSessions = async function(version) { Crypto.prototype.backupAllGroupSessions = async function(version) {