[bisq-network/bisq] (6/6) Clean up technical debt in P2PDataStorage and ProtectedStorageEntry objects (#3747)

Julian Knutsen notifications at github.com
Mon Dec 9 17:14:21 UTC 2019


julianknutsen commented on this pull request.



> -                    Utilities.toTruncatedString(toRemoveItem.getValue()));
-        });
-        removeFromMapAndDataStore(toRemoveList);
-
-        if (sequenceNumberMap.size() > this.maxSequenceNumberMapSizeBeforePurge)
-            sequenceNumberMap.setMap(getPurgedSequenceNumberMap(sequenceNumberMap.getMap()));
+        // Backdate all the eligible payloads based on the node that disconnected
+        map.values().stream()
+                .filter(protectedStorageEntry -> protectedStorageEntry.getProtectedStoragePayload() instanceof ExpirablePayload)
+                .filter(protectedStorageEntry -> protectedStorageEntry.getProtectedStoragePayload() instanceof RequiresOwnerIsOnlinePayload)
+                .filter(protectedStorageEntry -> ((RequiresOwnerIsOnlinePayload) protectedStorageEntry.getProtectedStoragePayload()).getOwnerNodeAddress().equals(peersNodeAddress))
+                .forEach(protectedStorageEntry ->  {
+                    // We only set the data back by half of the TTL and remove the data only if is has
+                    // expired after that back dating.
+                    // We might get connection drops which are not caused by the node going offline, so
+                    // we give more tolerance with that approach, giving the node the change to

Addressed in e8c8225

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/3747#discussion_r355574642
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191209/7eb52f74/attachment-0001.html>


More information about the bisq-github mailing list