[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:10:26 UTC 2019


julianknutsen commented on this pull request.



> -                                    if (protectedStorageEntry.isExpired(this.clock)) {
-                                        log.info("We found an expired data entry which we have already back dated. " +
-                                                "We remove the protectedStoragePayload:\n\t" + Utilities.toTruncatedString(protectedStorageEntry.getProtectedStoragePayload(), 100));
-                                        removeFromMapAndDataStore(protectedStorageEntry, hashOfPayload);
-                                    }
-                                } else {
-                                    log.debug("Remove data ignored as we don't have an entry for that data.");
-                                }
-                            }
-                        }
-                    });
-        }
+        if (closeConnectionReason.isIntended)
+            return;
+
+        if (!connection.getPeersNodeAddressOptional().isPresent())

I wish there was a better reason than this one, but I used this pattern because it reduces the number of lint errors from IDEA. If you don't have an `isPresent()` call prior to a `get()` it will highlight the word and raise an alert. You can suppress it, but that is just more code to add.

The other benefit is that mocking is bit less error-prone because you just need to mock out the Optional and not the wrapper class that has the `hasPeerNodeAddress()` function.

-- 
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_r355572548
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191209/29a1862b/attachment.html>


More information about the bisq-github mailing list