Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32171780
D15193.1765061048.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D15193.1765061048.diff
View Options
diff --git a/lib/tunnelbroker/use-peer-to-peer-message-handler.js b/lib/tunnelbroker/use-peer-to-peer-message-handler.js
--- a/lib/tunnelbroker/use-peer-to-peer-message-handler.js
+++ b/lib/tunnelbroker/use-peer-to-peer-message-handler.js
@@ -196,9 +196,19 @@
return;
}
- if (restoreBackupState.status !== 'no_backup') {
+ // Device should attempt to restore in two cases:
+ // 1. No backup, first restore ever.
+ // 2. Restore wasn't concluded, and the user decided to proceed.
+ // This could happen when adding a secondary with backup support on
+ // a primary that hasn't uploaded its first backup yet.
+ const needsRestore =
+ restoreBackupState.status === 'no_backup' ||
+ (restoreBackupState.status === 'user_data_restore_completed' &&
+ restoreBackupState.payload.forced);
+
+ if (!needsRestore) {
console.warn(
- 'Received backup data but backup action was already dispatched',
+ 'Received backup data but backup action should be ignored',
);
await sqliteAPI.removeInboundP2PMessages([messageID]);
return;
@@ -217,9 +227,11 @@
return;
}
- await userDataRestore(false, userID, accessToken, backupData);
-
- await sqliteAPI.removeInboundP2PMessages([messageID]);
+ try {
+ await userDataRestore(false, userID, accessToken, backupData);
+ } finally {
+ await sqliteAPI.removeInboundP2PMessages([messageID]);
+ }
} else if (
userActionMessage.type ===
userActionsP2PMessageTypes.FARCASTER_CONNECTION_UPDATED
@@ -240,7 +252,7 @@
primaryDeviceRequestedLogOut,
processDMOperation,
reBroadcastAccountDeletion,
- restoreBackupState.status,
+ restoreBackupState,
runDeviceListUpdate,
setLocalDCsSupport,
setLocalFID,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 6, 10:44 PM (6 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5840061
Default Alt Text
D15193.1765061048.diff (1 KB)
Attached To
Mode
D15193: [lib] improve handling backup keys from primary when user proceeded without restoring
Attached
Detach File
Event Timeline
Log In to Comment